vendredi 22 juillet 2016

How to remove the hyphens from the phone number

I have the phone number stored in the database in the '234-565-1233' format. I want to remove the hypens from this Following is the code i tried but nothing worked.'OncallDDl' hold the phone number value with hyphens.I want the value to be returned as 2345651233.And assign it back to the 'OncallDDL'. Can anyone hlpe me please

var str = OncallDDL.Text;
var newstr = str.Replace("/-/g",""); /error
var newStr = str.Replace(/-/g, ""); /error
var newStr = str.Replace("-", ""); /error
var newStr = str.Replace("\D", ""); /error

Aucun commentaire:

Enregistrer un commentaire