/// <summary>
/// 将参数扩展为指定长度的字符串,不足位数的在前方加0 /// </summary> /// <param name="origin"></param> /// <param name="length"></param> /// <returns></returns> public static string GetLengthString(string origin, int length) { int l = origin.Length;StringBuilder sb = new StringBuilder();
for (int i = 0; i < length - l; i++) sb.Append("0"); sb.Append(origin); return sb.ToString(); }