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

Return String from the right of space. 1

Status
Not open for further replies.

rtshort

IS-IT--Management
Feb 28, 2001
878
US
I have a lot of tables in SQL Server. Some of the names have the space in different places. I'm using remote scripting to get the names of all of the tables I want to use but I want to trim off everything on the Left of the string. Tables are named like:

1Eng Carb
1Eng Electrical
11Eng Carb
11Eng Electrical
111Eng Carb
111Eng Electrical

I'm filling list boxes and all I need is the Carb or Electrical part of the name in the listbox. No matter what the position of the space I just want the last part in the listbox. I use the sql Statement:

"Select * from SysObjects where name like '%11Eng%'

Since it's in an array I have to split the names.

AddToList= Split(rs.Fields("Name").value, ",")

How do I trim the name so all I get is what is after the space?
Rob
Just my $.02.
 
Try this;

For i = 0 Ubound(AddToList)
AddToList(i) = Right(AddToList(i), Len(AddToList(i)) - Instr(AddToList(i), " "))
Next
 
Thanks a million Spaz. For now I'll have to owe you and just give ya a star! Rob
Just my $.02.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top