部分匹配
○○. Contains("▲▲")
以 True or False 返回。
前向匹配
○○. StartsWith("▲▲")
以 True or False 返回。
向后匹配
○○. EndWith("▲▲")
以 True or False 返回。
删除空白
删除字符串开头和末尾的空格
○○.Trim()
删除换行符
○○ = ○○. Replace(Chr(13), ""). Replace(Chr(10),"")
替换字符
○○.replace("▽","▲")
例)text = "Hello,Word"
"text.replace(","、"~")
⇒"Hello~Word"
截取字符串
○○. Substring(▲,△)
括号内为数字。
▲:文字截取位置
△:截取文字的长度
截取位置是从0开始。
例)text = "我爱中国"
text.Substring(1,2)
⇒"爱中"
按位置截取位置后的所有字符
○○. Substring(▲)
▲:文字截取位置
例)test = "我爱中国"
test = test. Substring(1)
⇒ "爱中国"
字符串转数组
○○ = "字符串,字符串,字符串"
▲▲ [String[]类型] = ○○.Split(",")
例)text[String] = "字符1,字符2,字符3"
TEXT [String[]] = text.Split({“,”},StringSplitOptions.None)
⇒TEXT(0)= "字符1"
TEXT. Count.ToString = "3"
查找字符串中字符的位置
○○. IndexOf("▲▲")
查找字符串中指定字符的位置。
如果没有找到指定的字符,则返回负数。
例)test = "我爱中国"
test.IndexOf("爱"). ToString
⇒"1"