asp.net字符串取前几位的时候总是很繁琐,于是我想了个偷懒的办法,代码如下: str.ToString().PadRight(20).Substring(0,10).Trim() 转载于:https://www.cnblogs.com/lescper/p/4110135.html