In JavaScript, how do I trim from the right(string end)?
I have the following example:
var s1 = "this is a test~";
var s = s1.rtrim('~');
javascriptstringtrim
In JavaScript, how do I trim from the right(string end)?
I have the following example:
var s1 = "this is a test~";
var s = s1.rtrim('~');
Best Answer
Use a RegExp. Don't forget to escape special characters.