/// <summary> /// 从尾部截取字符串 /// </summary> /// <param name="sourceStr">源字符串</param> /// <param name="length">截取长度</param> public static string SubStringEnd(this string sourceStr, int length) { if (sourceStr.Length <= length) { return(sourceStr); } return(StringExtention.SubString(sourceStr, sourceStr.Length - length, length)); }
/// <summary> /// 截取字符串 默认0开始 /// </summary> /// <param name="sourceStr">源字符串</param> /// <param name="length">截取长度</param> public static string SubString(this string sourceStr, int length) { return(StringExtention.SubString(sourceStr, 0, length)); }