Split strings whit strings

  • Thread starter Thread starter Freddy Coal
  • Start date Start date
F

Freddy Coal

Hi, I would like split string with more than one separator, and assign the
result as array.

For example:

"car123house123truck123"

I need split my string in a array of 3 components

car
house
truck

How make that?

I try the split function (<chain.split("123")>), but I get
car
23house
23truck

Thanks in advance for any help.

Freddy Coal
 
Freddy said:
For example:
"car123house123truck123"
I try the split function (<chain.split("123")>), but I get
car
23house
23truck

Imports VB=Microsoft.VisualBasic

Dim s As String = VB.Split( chain, "123" )

Watch out for that trailing delimiter - you'll probably wind up with a
/four/-element array, with the last one being blank:

s(0) = "car"
s(1) = "house"
s(2) = "truck"
s(3) = (blank)

HTH,
Phill W.
 
freddy

Mostly is this problem the most simple to do by first changing the delimiter
using replace and than split it.

Cor
 
Back
Top