Click here to Skip to main content
13,090,426 members (48,604 online)
Click here to Skip to main content


13 bookmarked
Posted 30 Nov 2010

JavaScript Number Parsing and Formatting for Multicultural Environments

, 21 Dec 2010
A JavaScript class used to help in formatting and parsing numbers when parseInt and parseFloat are not enough
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;

namespace NumberFormatterExample
    public class NumberFormatInfo
        public string NegativeSign { get; set; }
        public int NumberDecimalDigits { get; set; }
        public string NumberDecimalSeparator { get; set; }
        public string NumberGroupSeparator { get; set; }
        public int NumberGroupSizes { get; set; }
        public int NumberNegativePattern { get; set; }

        public NumberFormatInfo()

        public NumberFormatInfo(System.Globalization.NumberFormatInfo infos)
            this.NegativeSign = infos.NegativeSign;
            this.NumberDecimalDigits = infos.NumberDecimalDigits;
            this.NumberDecimalSeparator = infos.NumberDecimalSeparator;
            this.NumberGroupSeparator = infos.NumberGroupSeparator;
            if(infos.NumberGroupSizes.Length > 0)
                this.NumberGroupSizes = infos.NumberGroupSizes[0];
            this.NumberNegativePattern = infos.NumberNegativePattern;

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Luc Veronneau
Web Developer Faltour Inc.
Canada Canada
From the beginning i have always been passionate about everything. I have never actually studied in computer programming but life brought me in IT departments from the beginning of my career. The more i programmed the more i liked it. Ever since, i've been hooked.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170813.1 | Last Updated 21 Dec 2010
Article Copyright 2010 by Luc Veronneau
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid