Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 131,567 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,163 people online right now. Registration is fast and FREE... Join Now!




Split Method

 
Closed TopicStart new topic

Split Method

zakary
post 23 Feb, 2005 - 08:01 AM
Post #1


D.I.C Regular

Group Icon
Joined: 15 Feb, 2005
Posts: 398



Thanked 6 times

Dream Kudos: 175
My Contributions


I have a question about the Spilt method.
Can I uses more than one split?

Example:

arraySomething = Split(stringSomething, "," Or stringSomething, " ")

I am read from a text file and I want to be able to handle if there is a space at the end of the line or after the comma but the comma needs to be my natural Split.
User is offlineProfile CardPM

Go to the top of the page


Amadeus
post 23 Feb, 2005 - 08:10 AM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,158



Thanked 32 times

Dream Kudos: 25
My Contributions


You can't use the Split like that, I'm afraid, but you can nest your split statements. Do you need to split on a space, or just the commas? If the commas only, you can use that for the split, then run through the resulting array items to take care of any spaces.

Conversely, if you do need to split on the space as well, you can replace all spaces with commas, then run the split.
User is offlineProfile CardPM

Go to the top of the page

tel0r
post 23 Feb, 2005 - 08:07 PM
Post #3


New D.I.C Head

Group Icon
Joined: 22 Feb, 2005
Posts: 27



Dream Kudos: 200
My Contributions


if you replace the spaces with a comma, you will end up with blank entries in your array, best off replacing with and empty string ("")

CODE

ArrSomething = Split(Replace$(Splitsomething, " ", ""), ",")
User is offlineProfile CardPM

Go to the top of the page

zakary
post 24 Feb, 2005 - 06:55 AM
Post #4


D.I.C Regular

Group Icon
Joined: 15 Feb, 2005
Posts: 398



Thanked 6 times

Dream Kudos: 175
My Contributions


Thanks tel0r that works the way I wanted it to

Thanks again
User is offlineProfile CardPM

Go to the top of the page

Closed TopicStart new topic
Time is now: 11/20/08 03:09AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month