strspn (String Span) Returns the length of the longest substring that begins at the start of the string and consists only of the characters found in the supplied character array.
Code Snippet
- private int strspn(string InputString, char[] Mask)
- {
- int count = 0;
- foreach (var c in InputString)
- {
- if (!Mask.Contains(c)) break;
- count++;
- }
- return count;
- }
strcspn (String Complement Span) Returns the length of the longest substring that begins at the start of the string and contains none of the characters found in the supplied character array.
Code Snippet
- private int strcspn(string InputString, char[] Mask)
- {
- int count = 0;
- foreach (var c in InputString)
- {
- if (Mask.Contains(c)) break;
- count++;
- }
- return count;
- }
- }