我正在使用VBScript
我得到了以下文本
str = "tcm:1-245-9"
现在我想以这样的方式子串上面的字符串,从而获得以下输出:
pstr = "245"
请仅用VBScript提供建议。
谢谢。
我正在使用VBScript
我得到了以下文本
str = "tcm:1-245-9"
pstr = "245"
请仅用VBScript提供建议。
谢谢。
标签。
Mid(string,start[,length])
string - Required. The string expression from which characters are returned
start - Required. Specifies the starting position. If set to greater than the number of characters in string, it returns an empty string ("")
length - Optional. The number of characters to return
或者使用。Split(expression[,delimiter[,count[,compare]]])
expression - Required. A string expression that contains substrings and delimiters
delimiter - Optional. A string character used to identify substring limits. Default is the space character
count - Optional. The number of substrings to be returned. -1 indicates that all substrings are returned
compare - Optional. Specifies the string comparison to use.
Can have one of the following values:
* 0 = vbBinaryCompare - Perform a binary comparison
* 1 = vbTextCompare - Perform a textual comparison
segments = Split(str,"-")
pstr = segments(1)