程序代码: |
Dim s As String = "0,1,2,"
Dim res As String() = s.Split(New Char() {","}, StringSplitOptions.RemoveEmptyEntries)
Dim res1 As String() = s.Split(New Char() {","})
For Each str As String In res
MsgBox(str)
Next
MsgBox(res.Length)
For Each str As String In res1
MsgBox(str)
Next
MsgBox(res1.Length)
"0,1,2," split 之后为“0”、“1”、“2”、“”
使用,StringSplitOptions.RemoveEmptyEntries,可以清除最后一个“”空字符串
[本日志由 tiancao1001 于 2022-02-23 03:28 PM 编辑]
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |