What's the JavaScript equivalent to this C# Method:
C#
var x = "|f|oo||"; var y = x.Trim('|'); // "f|oo"
C# trims the selected character only at the beginning and end of the string!
One line is enough:
var x = '|f|oo||'; var y = x.replace(/^|+||+$/g, ''); document.write(x + '<br />' + y);
1.4m articles
1.4m replys
5 comments
57.0k users