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

Extract Text After a Hyphen

Status
Not open for further replies.

fsub

Programmer
Feb 2, 2006
60
US
Hi,

Sample data are INV-7-10-1234 and INV-7-10-12345. I'd like to print just the last digits after the last hyphen. In the example, I want my report to print 1234 and 12345 respectively. Any ideas is greatly appreciated.
 
stringvar array x := split({table.field},"-");
x[ubound(x)]

-LB
 
Hi,
Use the InStrRev and Mid functions:

Mid({YourField},InStrRev("-")+1)

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks Lbass and Turkbear. I had to add the field as the first argument in InStrRev. Otherwise, both codes worked like a gem.
 
Hi,
Sorry 'bout that - glad you caught it.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top