标题:[转载]Visual Basic COM 讲座
只看楼主
冷雨纷飞
Rank: 1
等 级:新手上路
帖 子:38
专家分:0
注 册:2007-4-18
得分:0 
以下是引用Joforn在2007-4-15 18:49:12的发言:
会的人不会看,不会的看不懂。

非常经典!~


Now is future !~
2007-04-24 17:48
ioriliao
Rank: 7Rank: 7Rank: 7
来 自:广东
等 级:贵宾
威 望:32
帖 子:2829
专家分:647
注 册:2006-11-30
得分:0 

模拟vb.net string类:


Private Text_ As String
Public Enum Str_Conv '字格式转换常数
FirstByteToUpper = 3 '3 第一个英文字大写
HalfToAll = 4 '4 所有半型字转全型字
AllToHalf = 8 '8 所有全型字转半型字
SingleCodeToUnicode = 64 '64 所有Single Code字转成UniCode字
UniCodeToSingleCode = 128 '128 所有UniCode字转成Single Code字
End Enum

Property Get Text() As String
Text = Text_
End Property

Property Let Text(ByVal NewText As String)
Text_ = NewText
End Property


Public Function GetLeft(ByVal LeftIndex As Integer) As String '截取字串左边某几个字符
GetLeft = Left(Text_, LeftIndex)
End Function

Public Function GetRight(ByVal RightIndex As Integer) As String '截取字串右边某几个字符
GetRight = Right(Text_, RightIndex)
End Function

Public Function GetMid(ByVal MidIndex As Integer, ByVal LenIndex As Integer) As String '截取字串右边某几个字符
GetMid = Mid(Text_, MidIndex, LenIndex)
End Function


Public Function ToLower() As String '字符串全转小写
ToLower = LCase(Text_)
End Function
Public Function ToUpper() As String '字符串全转大写
ToUpper = UCase(Text_)
End Function
Public Function SetStrConv(ByVal TextConv As Str_Conv) As String '字格式转换
SetStrConv = StrConv(Text_, TextConv)
End Function

Public Function InStrIndex(ByVal SubText As String) As Integer '传回字串里某个字串在第几个字的位置
InStrIndex = InStr(Text_, SubText)
End Function

Public Function InStrBIndex(ByVal SubBText As String) As Integer '传回字串里某个字串在第几个字符的位置
InStrBIndex = InStrB(Text_, SubBText)
End Function

Public Function GetLen() As Integer '传回字串有多少字数
GetLen = Len(Text_)
End Function

Public Function GetLenB() As Integer '传回字串有多少字符
GetLenB = LenB(Text_)
End Function

Public Function InStrRevIndex(ByVal InstrRevText As String, ByVal StartFindIndex As Integer) As String 'InStrRev是从起始位置开始倒着找
InStrRevIndex = InStrRev(InstrRevText, StartFindIndex)
End Function

Public Function ToLTrim() As String '删除字串左边的空白字串
ToLTrim = LTrim(Text_)
End Function

Public Function ToRTrim() As String 'RTrim 删除字串右边的空白字串
ToRTrim = RTrim(Text_)
End Function

Public Function ToTrim() As String 'Trim 删除字串首尾的空白字串
ToTrim = Trim(Text_)
End Function

Public Function SetReplace(ByVal WillFindString As String, ByVal WillReplaceString As String, ByVal StartIndex As Integer, ByVal GroundIndex As Integer) As String
SetReplace = Replace(Text_, WillFindString, WillReplaceString, StartIndex, GroundIndex)
End Function '取代自串中某些字符串

Public Function LetStrReverse() As String '反转字符串
LetStrReverse = StrReverse(Text_)
End Function


/images/2011/147787/2011051411021524.jpg" border="0" />
2007-04-24 18:56
ioriliao
Rank: 7Rank: 7Rank: 7
来 自:广东
等 级:贵宾
威 望:32
帖 子:2829
专家分:647
注 册:2006-11-30
得分:0 
源代码:
H5hkLkU5.rar (9.61 KB) [转载]Visual Basic COM 讲座



/images/2011/147787/2011051411021524.jpg" border="0" />
2007-04-24 18:59
jiayong277
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2007-4-7
得分:0 
怎么没有注释的呢?
2007-04-24 21:10
ioriliao
Rank: 7Rank: 7Rank: 7
来 自:广东
等 级:贵宾
威 望:32
帖 子:2829
专家分:647
注 册:2006-11-30
得分:0 
这还要怎么样的注释

/images/2011/147787/2011051411021524.jpg" border="0" />
2007-04-24 22:08
alexandabell
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2008-8-23
得分:0 
长江后浪推前浪! 超越之!
2008-08-23 13:44
bbh236
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-8-27
得分:0 
厉害我眼都花了
2008-08-27 16:13
三断笛
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:31
帖 子:1621
专家分:1617
注 册:2007-5-24
得分:0 
后面的在其他地方看过了,前面两段刚刚才看到,好贴,翻出来晒晒
2008-10-23 03:22
allanwu244
Rank: 2
等 级:论坛游民
帖 子:134
专家分:20
注 册:2007-7-24
得分:0 
再一次看看 重复学习直至学会
谢谢楼主

边学边做,天天向上.
2010-07-19 21:33
brambleszp
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2010-10-28
得分:0 
向楼主学习,佩服ing……
2010-10-28 09:55



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-132089-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.405417 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved