class LangUtils {

	public static String pad(String s, int taotalLength, char append, boolean padLeft){
		Assert.isTrue(taotalLength>0, "total length must be >0");
		if(s==null){
			return s;
		}
		int length = Math.abs(taotalLength);
		if(s.length()==length)
			return s;
		StringBuilder str = new StringBuilder(s);
		if(str.length()<length){
			int lack = length-str.length();
			char[] appendChars = new char[lack];
			Arrays.fill(appendChars, append);
			if(padLeft){
				str.insert(0, appendChars);
			}else{
				str.append(appendChars);
			}
		}else{
			if(taotalLength>0)
				str.delete(length, str.length());
			else
				str.delete(0, str.length()-length);
		}
		return str.toString();
	}

}