我怎样才能在VB中将字符串拆分成双字母?
例如:abcdefgh
分成:ab cd ef gh
解决方法
我会把帽子扔进戒指:
Dim test As String = "abcdefgh" Dim results As New List(Of String) For i As Integer = 0 To test.Length - 1 Step 2 If i + 1 < test.Length Then results.Add(test.Substring(i,2)) Else results.Add(test.Substring(i)) End If Next MessageBox.Show(String.Join(" ",results.ToArray))