双星物语金手指怎么用:请教 VB 如何从一个字符开始向左截取字符串?

来源:百度文库 编辑:高考问答 时间:2024/05/12 02:13:57
例如 88888&99999
第一步想获取 88888
第二步 99999

怎么截取呢???
请注意 88888 和 99999 本来都是变量的,长度是不定的
重点:请问如何向右取????
88888888888&99966

想取 & 后面的

Dim strSrc As String
Dim strResult As String

strSrc = "88888888888&99966"
strResult = Right(strSrc, Len(strSrc) - InStr(1, strSrc, "&"))

dim str
dim result
str = "88888888888&99966 "
result = substring(str,instr(str,"&"))

对vb不熟,不知道对不对

使用InStr函数和InStrRev得到“&”的位置,如果有多个“&”,计算出相邻两个&的位置,再使用Mid函数截取。

PS:多个“&”的话,InStr函数和InStrRev这两个函数都要使用。