gpt4 book ai didi

vbscript - 如何在vbscript中对文本进行子串

转载 作者:行者123 更新时间:2023-12-03 18:16:52 24 4
gpt4 key购买 nike

我正在使用 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

关于vbscript - 如何在vbscript中对文本进行子串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4134115/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com