Example #1
0
 /// <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));
 }
Example #2
0
 /// <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));
 }
Example #3
0
 public static int IndexOf(this string sourceStr, int order)
 {
     return(StringExtention.IndexOf(sourceStr, '-', order));
 }
Example #4
0
 /// <summary>
 /// 字符串拆分
 /// </summary>
 /// <param name="sourceStr">源字符串</param>
 public static string[] SplitString(this string sourceStr)
 {
     return(StringExtention.SplitString(sourceStr, ","));
 }
Example #5
0
 /// <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));
 }