Link to home
Start Free TrialLog in
Avatar of vbkann
vbkann

asked on

searchng a string

If i have a string..say containing "me:You"
How can i use code to divide this string into two parts...one string containing the data before the : and the other string containing the data after.

eg original string = me:you
NewString One must = me
NewStringTwo must = you

How can i do this plz?
ASKER CERTIFIED SOLUTION
Avatar of slgal
slgal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ture
ture

vbkann,

If you have VB6, there is an even neater way... The brand new 'Split' function splits a delimited string into an array. Like this:

Sub TryThis()
  Dim txt, arr, i
  txt = "Me:and:you:Mary:and:Peter"
  arr = Split(txt, ":")
  For i = LBound(arr) to Ubound(arr)
    Msgbox arr(i)
  Next i
End Sub

Ture Magnusson
Karlstad, Sweden
Avatar of vbkann

ASKER

Thanks...no i dont have vb6 ..yet but thanks anyway