ClrPlus.Core.Extensions.StringExtensions.PositionOfFirstCharacterNotIn C# (CSharp) Метод

PositionOfFirstCharacterNotIn() публичный статический Метод

Gets the position of the first character that is not in the collection of characters passed in.
public static PositionOfFirstCharacterNotIn ( this str, char characters ) : int
str this The STR.
characters char The characters.
Результат int
        public static int PositionOfFirstCharacterNotIn(this string str, char[] characters) {
            var p = 0;
            while (p < str.Length) {
                if (!characters.Contains(str[p])) {
                    return p;
                }
                p++;
            }
            return p;
        }

Same methods

StringExtensions::PositionOfFirstCharacterNotIn ( this str, string characters ) : int