Split

用指定的分隔符将字符串分隔成一个字符串数组。

语法:

Split(Value)

Value: 用于分割字符串的字符或字符数组。

示例一

Dim Multi As String = "ab|cd|ef"
Dim
Values() as String
Values
= Multi.split("|")
For
Index As Integer = 0 To Values.Length - 1
    Output.Show(Values(Index
))
Next

在命令窗口执行上述代码之后,输出结果是:

ab
cd
ef

示例二

分割字符可以是一个数组,例如:

Dim Value As String = "foxtable|access/foxpro|excel/egrid"
Dim
sps() As Char = {"|","/"}
Dim
Names() As String  = Value.Split(sps)
For
Each name As String In Names
   
Output.Show(Name)
Next

在命令窗口执行上述代码之后,输出结果是:

foxtable
access
foxpro
excel
egrid

可以看到,"|"和"/"都参与了内容的分割

 


本页地址:http://www.foxtable.com/webhelp/topics/0245.htm