Use the Format() method to format a string : String : String C# Examples


C# Examples » String » String »

 

Use the Format() method to format a string









    
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);
    }

}
    
   
  
   



Output

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


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo String
» String