using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JY.Inspection.Common { public class StrUtil { /// /// 前端字节补0 /// /// /// /// public static string GetStartString(string str, int count) { string strRes = str; int strCount = str.Length; if (strCount != count) { strRes = str.PadLeft(count, '0'); } return strRes; } /// /// 增加结尾字节长度 /// /// /// /// public static string GetEndString(string str, int count) { string strRes = str; int strCount = str.Length; if (strCount != count) { strRes = str.PadRight(count, ' '); } return strRes; } /// /// 生成字符串List集合 /// /// /// public static List GetListString(int Num, string str) { List list = new List(); for (int i = 0; i < Num; i++) { list.Add(str); } return list; } } }