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.
Asked
Active
Viewed 1,556 times
3 Answers
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
-
Thanks! I was having trouble learning RB from Java. Thanks for the help. – user1232105 Feb 25 '12 at 15:51
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