例如,我有一个包含多个字符的字符串,"The quick fox jumped over the lazy dog"
我想将其划分为多个字符串,例如每个字符串都有两个字符,然后我将对它们进行特定操作,然后将它们重新加入,例如:
String(1) = "Th"
String(2) = "e "
String(3) = "qu"
String(4) = "ic"
等等 ...
如果字符串不能被分成相等的两个字符的字符串(例如“爸爸”),它会使最后一个字符串由最后一个剩余的字母组成,例如:
String(1) = "Da"
String(2) = "d"
我尝试了以下代码来生成变量:
Dim String(69) As String
For i As Integer = 0 To String.Length - 1
String(i) = "some text"
Next
和:
Dim text As String
For i As Integer = 0 To RichTextBox1.TextLength - 2 Step 2
text = RichTextBox1.Text.Substring(i, 2)
Next i
要将刺痛(richtextbox1.text)分成相等的部分,它可以工作,但我不能对每个子字符串做任何事情。
谢谢!