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 1030717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:44:41+00:00 2026-05-16T12:44:41+00:00

I want to add the thousands separator to a variable of type double .

  • 0

I want to add the thousands separator to a variable of type double. I have tried using String.format("%,f", x); and similar, but it seems to have a fixed number of decimal places, unlike Double.toString().

For example, with the value 1234.5:

Double.toString(): 1234.5
String.format(): 1.234,500000
Desired: 1.234,5

  • 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-05-16T12:44:42+00:00Added an answer on May 16, 2026 at 12:44 pm

    The NumberFormat class knows the decimal separator to use for your user’s locale.

    NumberFormat formatter = NumberFormat.getInstance();
    String formattedDouble = formatter.format(1234.5);
    

    You may use the setMaximumFractionDigits method if this gives you too many decimal places.

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

Sidebar

Related Questions

I have a string type which will return thousands of records in the format
I have a list of string values that I want add to a hashtable
Possible Duplicate: .NET String.Format() to add commas in thousands place for a number i
I want add UIGestureRecognizerDelegate to UIWebView,but failed. if [self.view addsubView:webView]; So UIWebView is ok,but
I have a website built with ASP.NET (3.5) and want add some level of
I have problem, when I want add Node to my GUI from other Thread.
I have numbers in javascript from 01(int) to 09(int) and I want add 1(int)
I want to add Gon ( https://github.com/gazay/gon ) to my activeadmin but I need
I want to add a comma in the thousands place for a number. Would
I have thousands of PHP pages which have a header and footer included using

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.