using System; namespace APT.Infrastructure.Core { /// /// 类型扩展方法类 /// public static class Int32Extensions { /// /// 返回一个新字符串,该字符串通过在此实例中的字符左侧填充指定的 Unicode 字符来达到指定的总长度,从而使这些字符右对齐。 /// /// /// /// /// public static String PadLeft(this Int32 source, int totalWidth, char paddingChar) { return source.ToString().PadLeft(totalWidth, paddingChar); } /// /// 返回一个新字符串,该字符串通过在此字符串中的字符右侧填充指定的 Unicode 字符来达到指定的总长度,从而使这些字符左对齐。 /// /// /// /// /// public static String PadRight(this Int32 source, int totalWidth, char paddingChar) { return source.ToString().PadRight(totalWidth, paddingChar); } } }