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 09:08:38 -0700 Lines: 44 Message-ID: References: <0.14085b2fab6b953fb903.20140115234423GMT.87bnzcolns.fsf@bsb.me.uk> X-Trace: individual.net 5FqTJJrUtWPS2lLjeUzYmgPyDbDC/6HY1pyihF9c/a3OhZZRUo Cancel-Lock: sha1:DkH8uWWmjVaXuGa9OHnrK9Vn0QA= 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:22638 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) ; ***********************************