Thank you very much it works now this is what i did.
Code:
'Adding the ParamArray Seperator
Const charNumber = 8
Dim oldString = userinput.text
Dim sb As New System.Text.StringBuilder()
For i As Integer = 0 To oldString.Length - 1
If i Mod charNumber = 0 Then
sb.Append("/"c)
End If
sb.Append(oldString(i))
Next
Dim newString = sb.ToString()
'The Split
Dim s As String = newString
Dim words As String() = s.Split(New Char() {"/"c})
Dim part As String
For Each part In words
Output. text = Output.text & vbNewLine & part
Next
Module Module1
Sub Main()
' We want to split this input string
Dim s As String = "there is a cat"
' Split string based on spaces
Dim words As String() = s.Split(New Char() {" "c})
' Use For Each loop over words and display them
Dim word As String
For Each word In words
Console.WriteLine(word)
Next
End Sub
End Module
Notice words is the array. Word is the split output
Last edited by dglienna; June 18th, 2012 at 10:45 PM.
Thanks, still it doesn't solve how i'm gunna let the ouput show 8 words on a line then a newline and then 8 words again, ect. ???
Must i take the array made at the split and make it add only 8 words to the string and then other 8 again?
Dim i As Integer
' Split The string
Dim s As String = userinput.text
' Split string based on spaces
Dim words As String() = s.Split(New Char() {" "c})
' Use For Each loop over words and display them
Dim word As String
For Each word In words
If i = 8 Or i = 16 Or i = 32 Or i = 40 Then
output.text = output.text& vbNewLine
Else
End If
i = i + 1
output.text = output.text & " " & word
Next
Dim i As Integer
' Split The string
Dim s As String = userinput.text
' Split string based on spaces
Dim words As String() = s.Split(New Char() {" "c})
' Use For Each loop over words and display them
Dim word As String
For Each word In words
If i = 8 Then
output.text = output.text& vbNewLine
i = 0
Else
End If
i = i + 1
output.text = output.text & " " & word
Next
Also, since you are building a new string, you might want to look into the "StringBuilder" object.
Bookmarks