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

  • Home
  • SEARCH
  • 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 8594127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:07:59+00:00 2026-06-12T00:07:59+00:00

I just started programming C# today, and I’m trying to get a handle on

  • 0

I just started programming C# today, and I’m trying to get a handle on the format strings.

I would like to output a string of this format:

{decimal number using a maximum of 10 columns} + 
" " + 
{decimal number taking a maximum of 10 columns}

I’ve tried

String outputFormat = "{0,-10:0.#####} {1,-10:0.#####}";
String output = String.Format(outputFormat, x, y);

But if x is 34059834.340598, I don’t get the output I want.

The first number takes more than 10 columns.

Is there a format string to force numbers to 10 columns? (Maybe show E notation if the n.m would be greater than 10 columns).

  • 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-12T00:08:00+00:00Added an answer on June 12, 2026 at 12:08 am

    I think you are looking for the G specifier for you number formating.

    Something like this (untested) should work:

    string tenCols = myDecimal.ToString("G10");
    

    Or to be more inline with what you had before, I think this should do it:

    String outputFormat = "{0,-10:G10} {1,-10:G10}";
    String output = String.Format(outputFormat, x, y);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started iOS programming and am failing to understand this.. I am trying
I've just started programming, therefore I'm kinda noob. I'm trying to use python to
How would you explain to someone who has just started programming in Java, what
I just started programming with objects recently and am trying to learn good habits
I just started programming in Xcode and I'm trying to write an iphone application.
Sorry for this, I've just started programming with wpf. I can't seem to figure
I just started to learn C programming. In my book there is this piece
I've just started learning D Programming. I'd like to deploy my programs on an
I just started programming in Objective-C. Prior to this I was primarily a C#
sorry for this newb question, i just started programming with php I'm following Yahoo

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.