admin管理员组

文章数量:1026925

Here is my string, tel:\\99999999999. Everytime I try to open it, it es with a single back slash like \99999999999.

How do I remove both the back slashes so that the phone number bees 99999999999?

Here is my string, tel:\\99999999999. Everytime I try to open it, it es with a single back slash like \99999999999.

How do I remove both the back slashes so that the phone number bees 99999999999?

Share Improve this question edited Oct 30, 2011 at 12:12 Peter Mortensen 31.6k22 gold badges110 silver badges133 bronze badges asked Aug 1, 2011 at 11:38 John CooperJohn Cooper 7,67133 gold badges83 silver badges102 bronze badges 0
Add a ment  | 

3 Answers 3

Reset to default 5
var tel = 'tel:\\99999999999';
tel = tel.replace(/\\/g, '');

Here is a demo

Try:

var telString = telString.replace("tel:\\\\","");

I think this will help you

stringPath.replace(/^.*[\\\/]/, '')

Here is my string, tel:\\99999999999. Everytime I try to open it, it es with a single back slash like \99999999999.

How do I remove both the back slashes so that the phone number bees 99999999999?

Here is my string, tel:\\99999999999. Everytime I try to open it, it es with a single back slash like \99999999999.

How do I remove both the back slashes so that the phone number bees 99999999999?

Share Improve this question edited Oct 30, 2011 at 12:12 Peter Mortensen 31.6k22 gold badges110 silver badges133 bronze badges asked Aug 1, 2011 at 11:38 John CooperJohn Cooper 7,67133 gold badges83 silver badges102 bronze badges 0
Add a ment  | 

3 Answers 3

Reset to default 5
var tel = 'tel:\\99999999999';
tel = tel.replace(/\\/g, '');

Here is a demo

Try:

var telString = telString.replace("tel:\\\\","");

I think this will help you

stringPath.replace(/^.*[\\\/]/, '')

本文标签: javascriptRemoving backslashes in a stringStack Overflow