Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
How do I strip spaces from string
Old 06-19-2010, 11:15 PM How do I strip spaces from string
Extreme Talker

Posts: 168
Name: James
Location: Australia
Trades: 0
Intorduction
I have this adsense type of thingy, which uses an XML file to send a list of text adverts.

The thing is with the text for the link. I want to have one line of text, that will both be used for the link in the a tag, AND, be on show in the Advertisement, and be spaced out and with Caps letters at the start of each word.

One method I used is to just have two tags, one for the spaced out display, and another for the link in the A tag. However, to save on many things like bandwidth, I want to have just one tag, which contains the Spaced out word version, then to have Javascript strip that down to just lowerCase URL string.

Examples are
Like where the XML file as the text My Domain . com that will be what will be on show. Then to have javascript change that to mydomain.com.

I do already know..
.... how to change it all to lower case, and that part of it works well

But I ask help with...
... How do I get it to strip spaces?

I have tried replace(' ','') but this did not work.


footer ambelon
The said XML file in the past always had two dom-elements, one for the spaced out text version, and the other for the A tag href. But I want to save on file size and bandwidth etc.

I am keen to have it spaced out like this because, while the person may not be interested in the product at that moment, they may have some interest in it, and would remember the domain name stated with it, IF, and only IF, it is layed out in a very easy to read format.
TRANZIT JIM is offline
Reply With Quote
View Public Profile Visit TRANZIT JIM's homepage!
 
 
Register now for full access!
Old 06-20-2010, 08:20 AM Re: How do I strip spaces from string
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
My favorite way is to create trim method to the String prototype. Here's an example: http://www.delphifaq.com/faq/f1031.shtml
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 06-20-2010, 09:08 PM Re: How do I strip spaces from string
Physicsguy's Avatar
404 - Title not found

Posts: 919
Name: Scott Kaye
Location: Ontario
Trades: 0
<script type="text/javascript">
function woot() {
var thestring = "this is a string";
box.innerHTML = thestring.replace(/ /g,"");
}
setTimeout("woot()",1);
</script>

<span id="box">booxxx!!!</span>

__________________
Check out my
Please login or register to view this content. Registration is FREE
or my
Please login or register to view this content. Registration is FREE
!
Physicsguy is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How do I strip spaces from string
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13210 seconds with 12 queries