Sub MyWordwrap(size As Int, spaces As Boolean)
Dim sb As StringBuilder
Dim w As String
Dim start = 0, sz = 0 As Int
For i= 0 To myList.size-1
w = myList.Get(i)
If spaces Then sz = sz+ w.Length+1 Else sz = sz+ w.Length
If sz = size +1 Then
sb.Initialize
For k = start To i
sb.Append(myList.get(k)).Append(" ")
Next
sb.Remove(sb.Length-1,sb.Length-1)
sb.Append(CRLF)
Log(sb.ToString)
start = i+1
sz = 0
End If
If sz > size Then
sb.Initialize
For k = start To i-1
sb.Append(myList.get(k)).Append(" ")
Next
sb.Remove(sb.Length-1,sb.Length-1)
sb.Append(CRLF)
Log(sb.ToString)
start = i
w = myList.Get(i)
If spaces Then sz = w.Length+1 Else sz = w.Length
End If
Next
sb.Initialize
For k = start To myList.size-1
sb.Append(myList.get(k)).Append(" ")
Next
Log(sb.ToString)
End Sub