i have getting Contact number from our device successfully . when i get number it is working fine in iphone but when i get this in Android it also get successfully but in android i m getting number in this format [ex: 123-123-12-12] so i want to replace this dash ('-') to space(" ") . my Code : var phonenum = phonenum.replace('-',' ');
This issue only in android plz give me suggest to resolved this.
var patt = new RegExp('-','g'); var unformated = '123-456-789'; var phonenum = unformated.replace(patt, " ");
The replace function uses a regular expression, so you need to do something like this:
phonenum = phonenum.replace(/-/g, ' ');
var unformated = '123-456-789'; var phonenum = unformated.replace(/-/g, " ");
Think you can help? Login to answer this question!