0

helo every one!

how can i split string in vb 6??? i got some string in list box which looks like this

item1 4 4.50
item2 2 4.00
item3 5 10.00

now i want to split that line into 3 different string.
any help will b appreciate . thx

3
Contributors
4
Replies
18
Views
8 Years
Discussion Span
Last Post by omoridi
1
Dim MyArray() As String
MyArray = Split(List1.List(1), " ") 'or if tab seperated vbTab instead of " "

Good Luck

0

thank you for your reply. but i got problem. i have tried this. for example if i have item in the list box which has got different whitespace...
item1 5 4.5
item2 4 2.00
some thing like this, so there is no fix whitespace in between. hope i explained properly.

0

Not really, I see no differenct between item 1 and 2. However, if split does not work for you and your example is an actual representation of your data, then you could use the Left Function, Mid Function, Trim Function, Right Function, and (etc. on string functions) to pull it apart manually.

Good Luck

0
s="1   2 3 4      5 6"
s=replace(s,"  "," ")   'Replace 2 Space to 1 space
dim v as variant
v=split(s," ")
'v(0)=1
'v(1)=2
'v(2)=3
'v(3)=4
'v(4)=5
'v(5)=6
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.