今天图老师小编给大家展示的是VB5里面实现VB6的InstrRev()和Split()一样的替换函数,精心挑选的内容希望大家多多支持、多多分享,喜欢就赶紧get哦!
【 tulaoshi.com - 编程语言 】
Private Function split_vb5(ByVal sstr As String, spstr As String) As VariantDim starstr, lenstr, cur As IntegerDim backstr() As Stringstarstr = InStr(sstr, spstr)cur = starstr + 1lenstr = Len(sstr)ReDim backstr(0)backstr(0) = Left(sstr, starstr - 1)For x = starstr + 1 To lenstr If Mid(sstr, x, 1) = spstr Then ReDim Preserve backstr(UBound(backstr) + 1) backstr(UBound(backstr)) = Mid(sstr, cur, x - cur) cur = x + 1 Debug.Print backstr(UBound(backstr)) End IfNextsplit_vb5 = backstr()End Function
'******************************
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)
Private Function InStrRev_vb5(ByVal start As Integer, ByVal str1 As String, ByVal str2 As String)str1 = revstr(str1)str2 = revstr(str2)start=Len(str1)-startInStrRev_vb5 = Len(str1) - InStr(start, str1, str2)End FunctionPrivate Function revstr(str As String) As StringDim x, lenstr As Integerlenstr = Len(str)For x = lenstr To 1 Step -1 revstr = revstr & Mid(str, x, 1)NextEnd Function(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)
来源:http://www.tulaoshi.com/n/20160219/1610353.html
看过《VB5里面实现VB6的InstrRev()和Split()一样的替换函数》的人还看了以下文章 更多>>