problem replacing spaces in a string

P

Philo Hippo

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/
 
P

Philo Hippo

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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top