Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split a string

Status
Not open for further replies.

VBXL

Programmer
Jul 10, 2001
198
GB
How do you split a string into variables i.e


1233566 888888 sasasa 8888888

i want

a = 1233566
b = 8888888
c = sasasa
d = 8888888

Cheers
 
You could use InStr in your own function to get the position of each space in the string, and then chop out the relevant parts using mid$().

However - the easiest way to do this is to use Split() - which returns a string array - each member of the array is a different component of the original string.

e.g.

Dim strComponents() As String

strComponents = Split ("1233566 888888 sasasa 8888888", " ")

In this case:

strComponents(0) = "1233566"
strComponents(1) = "888888"
strComponents(2) = "sasasa"
strComponents(3) = "8888888"

which is almost what you asked for!

Quros
 
Cheers it worked.

If i am looging for DOG in aysajgsDOGkas string

how do i do this
 
Use InStr ("aysajgsDOGkas", "DOG")

Also - Get an MSDN CD !!
 
he he. I was waiting for you to respond

he he

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top