Pad Strings from the left in CSharp

Description

The following code shows how to pad Strings from the left.

Example


  //  w  w  w  . ja va 2  s.co  m
  
  
   

    using System;


  public class PaddingStrings
  {
    static void Main(string[] args)
    {
      string MyString = "Hello World java2s.com";

      Console.WriteLine(MyString.PadLeft(50));
    }
  }

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var