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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:16:24+00:00 2026-06-15T23:16:24+00:00

I have a line of code for string formatting like below – double dVal

  • 0

I have a line of code for string formatting like below –

double dVal = Convert.ToDouble(args[0], 
                              System.Globalization.CultureInfo.InvariantCulture);
string result = string.Format("{0}", dVal);

Now in other locales (like German and French), the result string contains “,” instead of “.” Which is expected behavior.

Is there something I could add by which I will maintain my double value with its “.” and not containing “,”?

  • 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-15T23:16:25+00:00Added an answer on June 15, 2026 at 11:16 pm

    You can modify the current NumberFormatInfo object to set the decimal seperator explicitely to the seperator of your needs.

    Something like that should do the trick:

    double dVal = Convert.ToDouble(args[0],
                                      System.Globalization.CultureInfo.InvariantCulture);
    
    var nfi = NumberFormatInfo.CurrentInfo.Clone() as NumberFormatInfo;
    nfi.NumberDecimalSeparator = ".";
    
    string result = string.Format(nfi, "{0}", dVal);
    

    Note that you have to clone the NumberFormatInfo since the properties are read-only.

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

Sidebar

Related Questions

I have following line code in my view: <td> Model.some_instance_method(args) </td> I would like
I have the following line of code. <%= Html.Encode(string.Join(, , item.company1.companies.Select(x => x.company_name).ToArray())) %>
i have the next code: std::string line; std::ifstream myfile (text.txt); if (myfile.is_open()) { while
I have the line of code below... How would I modify it to insert
I have this line of code: System.Drawing.Icon icon = System.Drawing.Icon.FromHandle(shinfo.hIcon); A few lines later,
I have this line of code but it throws an error. What is the
I have a line of code that counts all attribute names that end in
I have one line of code which seems commented. Basically the thing I want
I have a line of code that gets the following error when run through
I have this line of code: this.Path = pathLookUpLocation.GetValue(RegLookupKey, null).ToString(); When I run static

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.