I would expect the array members to still have the EndOfLines in them so it might appear blank in the variable viewer in the debugger or in a TextField.
If your text starts with “$Item$”, the first element of your array will be empty, and the second element will start with a newline. Could that be what you are seeing?
I’m not worried about off-by-one errors at this point. Was just surprised that the debugger shows all fields as zero length. I guess I’ll carry on coding and see if it works, since the fields in the example program have content despite what the debugger shows.
You might also want to remove the first "$Item$, and then trim each field to remove leading and trailing return characters and whitepspaces.
s = s.Trim
If s.Left(6) = "$Item$" Then
//remove first one so you don't start with a blank field
s = s.Right(s.Length - 6)
End If
fields = s.Split("$Item$")
For i As Integer = 0 To fields.LastIndex
fields(i) = fields(i).Trim
Next