Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    formating numbers for a text box

    I'm looking to format numbers

    XXX,XXX.XX

    X.XX

    etc.

    Help would be wonderful.

    Thanks

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    2 decimals and adding , for 1,000+

    And more specifically:
    Code:
    Number.prototype.prettyPrint = function() {
    return this.toFixed(2).split('').reverse().join('').replace(/(\d{3}(?=\d))/g,'$1,').split('').reverse().join('');
    }

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks

    this should help :-D


  •  

    Posting Permissions

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