user1232105
user1232105

Reputation: 69

Splitting A String In Two Parts(REALBASIC)

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.

Upvotes: 0

Views: 1562

Answers (3)

Paul Lefebvre
Paul Lefebvre

Reputation: 6406

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

Upvotes: 0

Andrew Lambert
Andrew Lambert

Reputation: 1909

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"

Upvotes: 3

BKeeney Software
BKeeney Software

Reputation: 1299

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

Upvotes: 2

Related Questions