By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,302 Members | 1,788 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,302 IT Pros & Developers. It's quick & easy.

problem replacing spaces in a string

P: n/a
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/
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mon, 11 Oct 2004 04:48:23 +0100, Philo Hippo <ph**********@hotmail.com>
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.
Jul 23 '05 #2

P: n/a
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" <M.******@blueyonder.co.invalid> wrote in message
news:opsfo265fxx13kvk@atlantis...
On Mon, 11 Oct 2004 04:48:23 +0100, Philo Hippo <ph**********@hotmail.com>
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.


Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.