www.webdeveloper.com
Results 1 to 2 of 2

Thread: Trouble stripping commas

  1. #1
    Join Date
    May 2012
    Posts
    8

    Trouble stripping commas

    I have a string that I've pulled in from a text area as a string, I've done:
    Code:
    var punct_less = s.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g,"");
    				var finalString = punct_less.replace(/\s{2,}/g,"");
    Then I through it in an array, actually a couple sorting and resorting.

    Then I finally took the array and used toString() on it and then I have tried every permutation of .replace() to pull the commas out of the rather large string with no success. My latest attempt was:
    Code:
    inalstr = final.toString();    
    				finalstr.replace(/,/g, ' ');
    Could someone give me some guidance here? I've messed with reg exp as you can see up top...someone where when I split or toString it added all these commas. Thanks a lot people

  2. #2
    Join Date
    Nov 2010
    Posts
    1,097
    did you try with join?

    Code:
    arr =[1,2,3,4]
    alert(arr.join(""))

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles