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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:13:26+00:00 2026-06-03T03:13:26+00:00

When we convert like String.Format({0:C}, 126.45) it returns $126.45 but if we convert like

  • 0

When we convert like String.Format("{0:C}", 126.45) it returns $126.45

but if we convert like String.Format("{0:C}", -126.45) it returns ($126.45)

Why negative conversion return braces?
What to do if we don’t want this braces?

  • 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-03T03:13:27+00:00Added an answer on June 3, 2026 at 3:13 am

    Why don’t you try something like:

    String.Format("{0:$#,##0.00}", -126.45)
    

    According to the documentation here a format of “{0:C1}” or “{0:C2}” should work, but for some strange reason it is not..

    Another approach could be setting the CultureInfo:

    CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone();
    culture.NumberFormat.CurrencyNegativePattern = 1;
    string s = string.Format(culture, "{0:c}", -126.45);
    

    Reference here

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

Sidebar

Related Questions

I have string like 123-123-1234 so I want to convert string into this format
I want to convert a string like 2012-03-08T00:00:00+01:00 into Date.. I tried to use
I need to convert a string like this: A &#039;quote&#039; is <b>bold</b> into: A
Using PHP, what's the fastest way to convert a string like this: 123 to
I have a date that I would like to convert to String format. /Date(1281067200000)/
I have code like: lblFranshizShowInvwNoskhehEdit.Text = string.Format({0:n}, (double)(int.Parse(drDarman[FranshizDarsad].ToString()) * Convert.ToInt64(RadNumerictxtPayInvwNoskhehEdit.Text)) / 100); But {0:n0}
I'd like to convert a datetime format string like %m/%d/%y %H:%M into a regular
I parse a date that is in string format and would like to convert
I have datetime data in string format like this: Sat Mar 24 23:59:59 GMT
I need to convert a date in this string format: 2011-01-12T14:17:55.043Z to a number

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.