Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Mel Smith" Newsgroups: comp.lang.javascript Subject: Re: Removing ' ' from strings ?? Date: Thu, 16 Jan 2014 10:35:48 -0700 Lines: 31 Message-ID: References: <0.14085b2fab6b953fb903.20140115234423GMT.87bnzcolns.fsf@bsb.me.uk> <0.ae3d2a008e8309f72c9a.20140116161844GMT.87ob3blx23.fsf@bsb.me.uk> X-Trace: individual.net 2pfEbChJsNAyjMkctzF0mQ6vuV4Uo7k8yJB7P1zk4SjpLveCFB Cancel-Lock: sha1:Ki8cnNqSPMz32Y7fb3JGLMqK8lE= X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-RFC2646: Format=Flowed; Response Xref: csiph.com comp.lang.javascript:22641 Hi: The corrected real code is below. Unfortunately, the result id the same:   is replaced by " " for Chrome but *not* for IE8 ******************** option = el.options[nindex] ; // text string with multiple 'nbsp;' in it textstr = option.text ; textstr = textstr.replace(/ /g," ") ; // change ' ' 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) in IE8 alert("clubname=**"+clubname+"** Len = "+clubname.length) ;