Is there a JavaScript function that allows to to strip all the blank spaces to the right of the last character. I know VBScript has a RTrim function, does JavaScript have an equivilent?
Printable View
Is there a JavaScript function that allows to to strip all the blank spaces to the right of the last character. I know VBScript has a RTrim function, does JavaScript have an equivilent?
You can use a RegEx.
Now, I don't remember in JavaScript if it will match the largest it can or the first it finds. You might have to make the expression greedy to get what you want.Code:myString.Replace(/\s+$/, "");
Try it and see what works.Code:myString.Replace(/\s+$/g, "");