我会把帽子扔进戒指:
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))
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1094 次 |
最近记录: |