1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Just Numbers

Discussion in 'C#' started by moiseszaragoza, Sep 29, 2010.

  1. #1
    I was wondering if any one has a function that removes all nun Number characters from a string that would work on JScript



    Thanks for all the help
     
    moiseszaragoza, Sep 29, 2010 IP
  2. DennisXHopper

    DennisXHopper Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try the following:
    phone = +phone.replace(/\D/g,'');
     
    DennisXHopper, Sep 29, 2010 IP
  3. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #3
    
    function toNumber(str) {
         return str.replace(/[^0-9]+?/g,"");
    }
    
    Code (markup):
     
    camjohnson95, Sep 30, 2010 IP