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

Omit characters from left or right of a string

Status
Not open for further replies.

Buckaroo8

Programmer
Aug 6, 2003
27
US
HI All,
How do you omit characters from the left or right of a given string field?

Ex:
ABC-DEFGHI omit 'ABC-' = DEFGHI

I understand the LEFT & RIGHT functions, but I guess I need it to work in reverse - instead of 'keeping' a number of characters from the left or right, I need to omit them and display the remainder of the string.

Thanks for all help!
 
To display the string after the "-" use:

mid({table.string},instr({@string},"-")+1)

For the string to the left of the "-" use:

left({table.string}, instr({@string},"-")-1)

Another option is to use the split function:

split({table.string},"-")[1] //the first part

split({table.string},"-")[2] //the second part

-LB
 
Need help in reformating string. Current string is lastname,firstname just want to be able to print firstname lastname. Thanks for any help
 
You should start a new post, this thread is 9 months dead...

Try:

split({table.namefield},"-")[2]&" "&split({table.namefield},"-")[1]

-k
 
Hi,
Lbass's solution will work here as well( assuming always lastname,firstname)
try something like this:
Code:
@propername
arrName = split({namestring},',')
Fname = arrName[2]
Lname = arrName[1]
propername = trim(Fname) + ' ' + trim(Lname)
[profile]
 
This, as with most, use the same method as Lbass uses, just a slightly different order.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top