Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22638

Re: Removing ' ' from strings ??

From "Mel Smith" <med_cutout_syntel@aol.com>
Newsgroups comp.lang.javascript
Subject Re: Removing '&nbsp;' from strings ??
Date 2014-01-16 09:08 -0700
Message-ID <bjqegcFqgpcU1@mid.individual.net> (permalink)
References <bjog40Fe7h5U1@mid.individual.net><XnsA2B6F00B7DFE3eejj99@194.109.133.133> <0.14085b2fab6b953fb903.20140115234423GMT.87bnzcolns.fsf@bsb.me.uk> <bjom61FfeukU1@mid.individual.net>

Show all headers | View raw


Hi All:

    My IE8 still won't change the nbsp; coding to spaces altho Chrome does 
so.

    Below is my actual latest test code

    and here is the definition of my alltrim() function

function alltrim(str) {
   return str.replace(/^\s+|\s+$/g,"") ;
}

Thanks

-Mel Smith


********* latest test code *************
option = el.options[nindex] ; // text string with multiple 'nbsp;' in it
textstr = option.text ;
textstr = textstr.replace(/nbsp;/g," ") ; // change nbsp; into space 
globally

// get the clubname first
npos1 = textstr.search("Tees") ;
clubname = textstr.substring(0,npos1) ;
alert("a. Code at start= " + clubname.charCodeAt(0)+"  Code at end= 
"+clubname.charCodeAt(clubname.length-1)) ;
clubname = alltrim(clubname) ;   // trim spaces off of the ends of the 
clubname
alert("b. Code at start= " + clubname.charCodeAt(0)+"  Code at end= 
"+clubname.charCodeAt(clubname.length-1)) ;
// in both alerts above the chars at the start and end are Unicode 160 
(unbreakable space) for IE8

alert("clubname=**"+clubname+"**  Len = "+clubname.length) ;
***********************************





Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Removing '&nbsp;' from strings ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-15 15:23 -0700
  Re: Removing '&nbsp;' from strings ?? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-15 23:35 +0100
    Re: Removing '&nbsp;' from strings ?? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-01-15 23:44 +0000
      Re: Removing '&nbsp;' from strings ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-15 17:07 -0700
        Re: Removing '&nbsp;' from strings ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-16 09:08 -0700
          Re: Removing '&nbsp;' from strings ?? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-01-16 16:18 +0000
            Re: Removing '&nbsp;' from strings ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-16 10:23 -0700
              Re: Removing '&nbsp;' from strings ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-16 10:35 -0700
                Re: Removing '&nbsp;' from strings ?? Martin Honnen <mahotrash@yahoo.de> - 2014-01-16 18:58 +0100
                Re: Removing '&nbsp;' from strings ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-16 11:05 -0700
                Re: Removing '&nbsp;' from strings ?? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-01-16 18:01 +0000
                Re: Removing '&nbsp;' from strings ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-16 11:10 -0700
                Re: Removing '&nbsp;' from strings ?? Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-16 19:17 +0000
                Re: Removing '&nbsp;' from strings ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2014-01-16 13:37 -0700

csiph-web