コード例 #1
0
 public static int CountWhileNot(this string str, int start, CharSet chars, long max = int.MaxValue)
 {
     var index = start;
     max = Math.Min(index + max, str.Length);
     while (index < max && !chars.Contains(str[start]))
     {
         index += 1;
     }
     return index - start;
 }
コード例 #2
0
 public static int CountWhileNot(this Subject subject, CharSet chars, long max = int.MaxValue)
 {
     var start = subject.Index;
     var index = start;
     max = Math.Min(start + max, subject.Text.Length);
     while (index < max && !chars.Contains(subject.Text[index]))
     {
         index += 1;
     }
     return index - start;
 }
コード例 #3
0
 public static string TakeWhile(this Subject subject, CharSet chars, long max = int.MaxValue)
 {
     var start = subject.Index;
     var index = start;
     max = Math.Min(start + max, subject.Text.Length);
     while (index < max && chars.Contains(subject.Text[index]))
     {
         index += 1;
     }
     return index > start ? subject.Take(index - start) : "";
 }
コード例 #4
0
 public CharSet(CharSet chars)
     : this(chars.Chars)
 {
 }