/// <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)); }
public static int IndexOf(this string sourceStr, int order) { return(StringExtention.IndexOf(sourceStr, '-', order)); }
/// <summary> /// 字符串拆分 /// </summary> /// <param name="sourceStr">源字符串</param> public static string[] SplitString(this string sourceStr) { return(StringExtention.SplitString(sourceStr, ",")); }
/// <summary> /// 删除字符串 /// </summary> /// <param name="sourceStr">源字符串</param> /// <param name="trimStr">删除的字符</param> /// <returns></returns> public static string Trim(this string sourceStr, string trimStr) { return(StringExtention.Trim(sourceStr, trimStr, true)); }