2 Replies Latest reply on Jan 7, 2010 6:20 AM by HarboSenior

    In the money, but none the richer [CS3,JS]


      I've extracted a story from ID, put all the pounds sterling into an array and am stepping through it, converting to the euro values.


      So on each iteration I end up with two variables, poundsToChange (£500,000) and euroSum (€556421 ... I know, far too much detail, but I'll get round to simplification when I've got the basics working)


      For simplicity's sake, I'm using JS' replace command, but nothing is happening...


      var changeToEuros = textToSearch.replace(/poundsToChange/g, euroSum);


      Is this because the variables' names are being searched for in stead of their contents? If so, is there a fix for this?


      While I'm here, in order to do the conversion I've had to remove the commas from the thousands, hundreds of thousand etc. Does anyone have a handy function to which I could entrust my millions and get my commas back?


      With all these riches about, all I can offer is my gratitude...