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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:28:48+00:00 2026-06-06T14:28:48+00:00

given value = 2 or 4.00 the below statement outputs value = Convert.ToDecimal(value).ToString(C2); value

  • 0

given value = 2 or 4.00

the below statement outputs

value = Convert.ToDecimal(value).ToString("C2");

value = $2.00, or $4.00

if I have value = 1000 then output will be $1,000.00 but I require $1000.00.

I don’t prefer string concatenation of “$” and value.

  • 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-06T14:28:50+00:00Added an answer on June 6, 2026 at 2:28 pm
    var stringValue = Convert.ToDecimal(value).ToString("$0.00");
    

    As noted by @James below, this hard-codes the currency into the format. Using the format C2 will use the system currency format. This can be changed for the system (e.g. in Windows 7 – Start – Control Panel – Change Display Language – Additional Settings – Currency – Digit grouping) and will allow the C2 format to display the currency value without the comma when running on that particular system.

    EDIT

    All credit to @James for using the current culture. My only modification to his answer would be to clone the current NumberFormat so as to get all the properties of the current culture number format before removing the CurrencyGroupSeparator.

    var formatInfo = (NumberFormatInfo)CultureInfo.CurrentCulture.NumberFormat.Clone();
    formatInfo.CurrencyGroupSeparator = string.Empty;
    
    var stringValue = Convert.ToDecimal(value).ToString("C", formatInfo);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app, and the username field will convert any given value to
i need Enumarable value from below class but give error public static Enumerable LoadDataByName(string
I have a menu. Given a given value, I would like to return the
I have a class C(Of T). I want to determine if some given value
Ok, so this is the question. Let's say I have a given value: 2000;
I am using the below SP to return the value of Generated Insert statement
The below log snippet shows the parameters that get passed in, but then when
I have the below code that splits the sql statement and give its indices
Given the code below, how do I compare a List of objects's values with
The question is how to round a given value to the nearest almost exact

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.