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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing spaces and all text to the right

Status
Not open for further replies.

captainquigers

Programmer
Jun 4, 2004
7
GB
How would I go about removing unwanted spaces from a text string and all text to the right of this?

e.g.

"xx1 pl5605" -----> xx1
"g8 jj77" -----> g8

I've tried various combinations of trim and clean but can't get them to work.

Please note that there can be any number of spaces but I want to remove everything to the right of the first space that occurs.

Cheers,

Paul.
 
Or you could use the split function.

arString = split(string, " ")


then your first "segment" would be

strVar = arString(0)



_______
I love small animals, especially with a good brown gravy....
 
I was using the function builder in Access and unfortunately don't have the option of using the split function.

The InStr and Left commands worked fine though.

I'll have to start looking at using VB to manipulate data. It looks far more flexible.

Thanks for the answers,

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top