0

I am trying to split a string at the character ":" but cant create two separate strings from the split. If somebody could help me, I would appreciate it.

MPelletier
  • 16,256
  • 15
  • 86
  • 137
user1232105
  • 69
  • 1
  • 1
  • 4

3 Answers3

3

In RealBasic, the Split method doesn't create two (or more) separate strings but rather a single string array.

Dim s() As String = Split("Zero:One:Two", ":")
's() now contains the substrings like so:
's(0) = "Zero"
's(1) = "One"
's(2) = "Two"
Paul Lefebvre
  • 6,253
  • 3
  • 28
  • 36
Andrew Lambert
  • 1,869
  • 1
  • 17
  • 31
2

Actually, the code is incorrect. It should be:

Dim s() As String = Split("Zero:One:Two", ":")

If you don't pass in the delimiter it assumes a space which wouldn't work in this case.

The online docs are at http://docs.realsoftware.com/index.php/Split

BKeeney Software
  • 1,299
  • 6
  • 8
0

Split is best for actually splitting the text, but you can also use the string-manipulation methods: Left, Right, Mid and InStr.

Paul Lefebvre
  • 6,253
  • 3
  • 28
  • 36