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

Remove Special Characters

Status
Not open for further replies.

jjenright

Technical User
May 23, 2006
14
US
I would like to remove all special characters from a text field. Special characters include an X, ., -. For example,

X123456
987.654
99-8888

Usually, the X will be in the first position. I would like to remove all . (dots) and - (dashes) and have the remaining text displayed, 123456, 987654, 998888. Can I remove all of these characters at one time ? Thabks for your help!
 
I think you could just use:

numbervar i;
numbervar j := len({table.string});
stringvar newstr;

for i := 1 to j do(
if isnumeric({table.string}) then
newstr := newstr + {table.string};
newstr;

This assumes that you only want numbers in the resulting field.

-LB
 
If it's just those characters, you can also use a basic replace function:

replace(replace(replace({table.field},"X",""),"-",""),".","")

I'd avoid the UFL if possible.

LB's solution looks great if you only want the numerics output, and your software version supports it.

Please remember to post the basics in the future.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top