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

How to remove '$' and ',' from a number field.

Status
Not open for further replies.

RayBec

Programmer
Dec 5, 2001
42
0
0
US
What's the format to remove $ and , from a number field input on a web site?
 
Code:
$input=~tr/\$,//;

where
Code:
$input
contains the value of the field.
 
Thanks...one thing I didn't think about was that I need to remove the trailing decimal figures...for example...if a user enters $600.00, I want to actually convert to 600. How would I remove those two trailing zeros????
 
$_ = "600.00";
/\./;
$_ = $`;
print;
Mike
________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top