10-19-2013, 12:09 PM
I have already another question, I'm not asking how to do something for a change.
I have written something but it seems that it doesn't work properly and I don't know what the problem is.
The purpose of the code is to divide a key (length of key can varie) into parts of each 4 characters.
[code2=vbnet]Dim strings As New List(Of String)
'Just an example of the key, this string will be generated randomly
Dim s As String = "p6s0arJHmuOQmUhIczfnynRS1dOrRxYm0EF05b5Vk1YR7TQVItShNjFJQ1L3d"
Dim i As Integer = 0
Dim intMaxNumber As Integer = CInt(Math.Round((s.Length / 4), 0))
For i = 0 To intMaxNumber Step 4
strings.Add(s.Substring(i, 4))
Next
For Each srtininglist As String In strings
MessageBox.Show(srtininglist)
Next[/code2]
Everything goes fine when I debug it but it seems that the code only returns 4 parts, and it should (in this case) be about 16 parts.
I'm probably making a logical mistake but I can't figure out what I'm doing wrong.
Hope someone can help me out,
Brecht
I have written something but it seems that it doesn't work properly and I don't know what the problem is.
The purpose of the code is to divide a key (length of key can varie) into parts of each 4 characters.
[code2=vbnet]Dim strings As New List(Of String)
'Just an example of the key, this string will be generated randomly
Dim s As String = "p6s0arJHmuOQmUhIczfnynRS1dOrRxYm0EF05b5Vk1YR7TQVItShNjFJQ1L3d"
Dim i As Integer = 0
Dim intMaxNumber As Integer = CInt(Math.Round((s.Length / 4), 0))
For i = 0 To intMaxNumber Step 4
strings.Add(s.Substring(i, 4))
Next
For Each srtininglist As String In strings
MessageBox.Show(srtininglist)
Next[/code2]
Everything goes fine when I debug it but it seems that the code only returns 4 parts, and it should (in this case) be about 16 parts.
I'm probably making a logical mistake but I can't figure out what I'm doing wrong.
Hope someone can help me out,
Brecht