Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > problem replacing spaces in a string

Reply
Thread Tools

problem replacing spaces in a string

 
 
Philo Hippo
Guest
Posts: n/a
 
      10-11-2004
Hi,

I need to be able to remove spaces from the beginning or the end of a
string.

This is my very 1st attempt at doing that in JS and here is what i got:

function SearchForDomains(winName, SearchWhat)
{
var re = /\s*(\w*)\s*/;
SearchWhat=SearchWhat.replace(re, "$1");
....

that gets rid of the spaces at the front of the string, but not at the end
of it.

Can you help me please?


--

Hope that helps,

Phil
http://uk.geocities.com/philippeoget
philippeoget at yahoo dot com

Programming Excel: <a
href="http://uk.geocities.com/philippeoget/xl/InternetLinkOrganiser.zip"
target="_blank">The Excel A2Z Project: </a>
http://uk.geocities.com/philippeoget/a2z/


 
Reply With Quote
 
 
 
 
Michael Winter
Guest
Posts: n/a
 
      10-11-2004
On Mon, 11 Oct 2004 04:48:23 +0100, Philo Hippo <(E-Mail Removed)>
wrote:

> I need to be able to remove spaces from the beginning or the end of a
> string.


A solution has already been provided in the FAQ
(<URL:http://jibbering.com/faq/>).

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
 
Reply With Quote
 
 
 
 
Philo Hippo
Guest
Posts: n/a
 
      10-12-2004
Thank you Mike


Phil
http://uk.geocities.com/philippeoget
philippeoget at yahoo dot com

Programming Excel: <a
href="http://uk.geocities.com/philippeoget/xl/InternetLinkOrganiser.zip"
target="_blank">The Excel A2Z Project: </a>
http://uk.geocities.com/philippeoget/a2z/

"Michael Winter" <(E-Mail Removed)> wrote in message
newspsfo265fxx13kvk@atlantis...
> On Mon, 11 Oct 2004 04:48:23 +0100, Philo Hippo <(E-Mail Removed)>
> wrote:
>
> > I need to be able to remove spaces from the beginning or the end of a
> > string.

>
> A solution has already been provided in the FAQ
> (<URL:http://jibbering.com/faq/>).
>
> [snip]
>
> Mike
>
> --
> Michael Winter
> Replace ".invalid" with ".uk" to reply by e-mail.




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XSD to allow A-Z 0-9 and spaces, but not leading/trailing spaces johkar XML 2 12-10-2009 09:24 AM
[CSS] how can I show spaces as spaces? Tomasz Chmielewski HTML 21 09-10-2009 06:43 PM
how can I show spaces as spaces, part 2 Tomasz Chmielewski HTML 14 09-10-2009 03:54 PM
Re: How to trim a String trailing spaces, but not leading spaces? Roedy Green Java 3 09-14-2008 02:10 AM
Re: How to trim a String trailing spaces, but not leading spaces? John B. Matthews Java 4 09-12-2008 05:28 AM



Advertisments