拆分字符串:

Split(要拆分的字符串,分割的符号/字符) 返回类型:数组

例如:

strText = "1,2,3,4"        '给字符串赋值
strResult() = Split(strText, ",")     '以逗号为分割,截断字符串

strResult()数组结果如下(下标从0开始):

1 2 3 4

判断字符串是否为空:

If Len(strText) = 0 Then

end if

在字符串中找字符/字符串:

Instr()    返回字符或字符串在另一个字符串中第一次出现的位置

Instr(搜索的起始位置,接受搜索的字符串, 要搜索的字符)

搜索的起始位置: 可不填

例如:

pos = Instr( "This is a test!!", "b") 'pos  结果为0

pos = Instr( "This is a test!!", "a") 'pos  结果为9

✳如果接受搜索的字符串中没有要搜索的字符串,则返回结果为0。

详细讲解参考百度Instr()_百度百科 (baidu.com)

posted on 2022-08-01 17:11  爱吃玉米的tutu  阅读(3694)  评论(0)    收藏  举报