积极答复者
split问题

问题
答案
-
您好
參考以下代碼
Dim a As String = "_3___211001110000_030__437" Dim bCheck As Boolean = True '是否為 _ For Each c In a If c = "_" Then TextBox1.Text &= vbCrLf If bCheck = False Then TextBox1.Text &= vbCrLf End If bCheck = True Else TextBox1.Text &= c bCheck = False End If Next
歡迎參觀我的Blog.NET菜鳥自救會
- 已标记为答案 ckjason 2012年4月3日 9:20
全部回复
-
-
TextBox1.Text &= a.Replace("_", vbCrLf)
Dim a As String = "3___211001110000_030__437" Dim b() As String = Split(a, "_") For Each c In b TextBox1.Text &= a.Replace("_", vbCrLf) Next
出现这样的结果??
我想要的结果:
3
xxxx
xxxx
xxxx
211001110000
xxxx
030
xxxx
437
-
不用循环
Dim a As String = "3___211001110000_030__437"
TextBox1.Text = a.Replace("_", vbCrLf)
-
不用循环
Dim a As String = "3___211001110000_030__437"
TextBox1.Text = a.Replace("_", vbCrLf)
还是一样,就是少空一行?? -
您好
參考以下代碼
Dim a As String = "_3___211001110000_030__437" Dim bCheck As Boolean = True '是否為 _ For Each c In a If c = "_" Then TextBox1.Text &= vbCrLf If bCheck = False Then TextBox1.Text &= vbCrLf End If bCheck = True Else TextBox1.Text &= c bCheck = False End If Next
歡迎參觀我的Blog.NET菜鳥自救會
- 已标记为答案 ckjason 2012年4月3日 9:20