Padding string is to add specified character to a string to a given length.
We can choose the pad left or right.
using System;
class Sample
{
public static void Main()
{
string s = "java2s.com";
s = s.PadLeft(20,'=');
Console.WriteLine(s);
s = s.PadRight(40,'+');
Console.WriteLine(s);
}
}
The output:
==========java2s.com
==========java2s.com++++++++++++++++++++
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |