Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Trimming the Spaces of the end of a string


Message #1 by "Andrew Scott" <Andrew@c...> on Wed, 13 Dec 2000 15:52:31 -0000
If you are familiar with regular expressions, you can use the replace
method.
To remove trailing spaces, use:

strValue = strValue.replace(/(\s+$)/,"");

For preceding spaces use:

strValue = strValue.replace(/(^\s+)/,"");

> Hi all
> 
> Is there a method in Jscript that trims any extra spaces of the ends of
> string?
> 
> such as the trim methoh in JAVA or VO and I guess Loads of other
> languages?
> 
> Thanks
> Andy
> 

--- 
NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE okay?
Visit EarthWeb for the latest in IT Management, Software Development, 
Web Development, Networking & Communications, and Hardware & Systems.  
Click on http://www.earthweb.com for FREE articles, tutorials,
and discussions from the experts.
---
You are currently subscribed to javascript as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-javascript-$subst('Recip.MemberIDChar')@p2p.wrox.com

  Return to Index