Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8447943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:17:59+00:00 2026-06-10T10:17:59+00:00

I’m looking for a format specifier scheme for numbers that bears the characteristics of

  • 0

I’m looking for a format specifier scheme for numbers that bears the characteristics of the ubiquitous “YYYY-MM-DD” etc. format specifiers for dates. I’m looking for:

  1. Easy to process: It shouldn’t take a lot of effort (algorithmic complexity, performance) to format a number.
  2. (Optional) User-friendly: It is intuitive enough for users to directly work with this syntax.
  3. Account for thousands separators and decimal places.

Even though my target domain is JavaScript (i.e. formatting Number instances), I prefer a specifier scheme that is standard, intuitive etc. instead of JavaScript-native. And no, I don’t think the printf number format specifiers are intuitive enough to present to users.

The scheme I’ve come up with so far is:

#,###.##

to say:

  1. The whole part uses groups of 3 digits separated by commas
  2. Use 2 decimal places and use a period as the delimiter

I’m feeling “meh” about this scheme and don’t want to invest too much time in implementing it before seeing better alternatives.

What I’ve also experiemented with is, to be done with a format specifier and actually use a preferences object with distinct properties for thousands/decimal delimiters, number of decimal places etc. and abstract it by presenting to the user sample number outputs to pick from.

Should I forget about using a format specifier scheme and just use a set of properties that are abstracted at presentation layer? Is there a standard(ish) specifier that meets the 3 criteria I mentioned at the top?

At the end of the day, I’m not without a solution and I have enough to get me going. I’m just looking for a more ideal solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:18:00+00:00Added an answer on June 10, 2026 at 10:18 am

    XSLT is a standard which has a comprehensive decimal-format scheme.

    format-number(5351,"#,###.##")
    

    ECMA-402 is another standard which has a number formatting API:

    A culture-sensitive NumberFormat object can be constructed using the Intl.NumberFormat constructor with desired locale tag and options. The format method of the NumberFormat object may be used to format numeric data based on the locale and options set. Number.prototype.toLocaleString has also been updated to internally use Intl.NumberFormat for culture sensitive formatting and now supports two optional arguments – locale and options.

    var number = 1123456.789;
    
    // request a US formatted number
    console.log("United States: " + new Intl.NumberFormat('en-US').format(number));
    
    // limit to three significant digits
    console.log("3 significant digits: " + new Intl.NumberFormat('en-US', { maximumSignificantDigits: 3 }).format(number));
    
    // request a French formatted number
    console.log("France: " + new Intl.NumberFormat('fr-FR').format(number));
    
    // request a Indian formatted number
    console.log("India: " + new Intl.NumberFormat('en-IN').format(number));

    A more user friendly solution would be something like the NumberFormat or DecimalFormat schemes of CFML.

    References

    • Building world-ready applications in JavaScript using IE11 – IEBlog

    • Intl.NumberFormat – JavaScript | MDN

    • Language subtag lookup app

    • Choosing a language tag

    • W3C I18N Server Setup Techniques

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I know there's a lot of other questions out there that deal with this
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.