/**
* Feel free to copy and use this.
* If you have any comments or better solutions, please paste on my blog:
* http://blog.yanmingyu.com or email me feedback.andrewyu@gmail.com
*/
public static String rightPadding(String str, int size, char padChar)
{
String padded = str;
while (padded.length() < size)
{
padded = padded + padChar;
}
return padded;
}
public static String leftPadding(String str, int size, char padChar)
{
String padded = str;
while (padded.length() < size)
{
padded = padChar + padded;
}
return padded;
}
No comments:
Post a Comment