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

replace method Help!!!!!!!!

Status
Not open for further replies.

deharris2003

Programmer
Jul 1, 2003
41
US
Ok so I have a simple fuction. All I want to do is convert all . to /

doesnt seem to work very well

here goes

function DoThese(date_field) {

if (date_field.indexof(".") != -1)
date_field = date_field.replace(".","/");
validate_date(date_field);
doValidateField(date_field);
}

everything seems to work fine without the

if (date_field.indexof(".") != -1)
date_field = date_field.replace(".","/");

of course that doent do what I need

Thanks for your help
 
The replace function is for regular expressions, not strings.

var fullstop = /\./gi;
date_field = date_field.replace(fullstop,"/");


Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top