|
-
Jan 28th, 2002, 09:57 AM
#1
Thread Starter
Addicted Member
JavaScript RTrim Fuction
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?
-
Jan 28th, 2002, 01:20 PM
#2
Frenzied Member
You can use a RegEx.
Code:
myString.Replace(/\s+$/, "");
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+$/g, "");
Try it and see what works.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|