Maha

Maha

  • NA
  • 0
  • 328.6k

NP136 what is the meaning of it?

Aug 25 2008 7:08 AM

Hi Guys

 

NP136 what is the meaning of it?

 

In the following program elements in the bracket of String.Format() method (highlighted in yellow) can be unerstood as follows:

 

0 – Position of the variable

f – Floating point

3 – Number of digits

 

10 – What is the meaning of it?

 

Please explain the reason.

 

Thank you

 

using System;

 

class MainClass

{

    public static void Main()

    {

        float myFloat = 1234.56789f;

 

        string myString8 = String.Format("{0, 10:f3}", myFloat);

 

        Console.WriteLine("String.Format(\"{0, 10:f3}\", myFloat) = " + myString8);

    }

}

/*

String.Format("{0, 10:f3}", myFloat) =   1234.568

*/

 


Answers (8)