UnityEditor.SearchUtility.FindFirstPositionNotOf C# (CSharp) Méthode

FindFirstPositionNotOf() private static méthode

private static FindFirstPositionNotOf ( string source, string chars ) : int
source string
chars string
Résultat int
        private static int FindFirstPositionNotOf(string source, string chars)
        {
            if (source != null)
            {
                if (chars == null)
                {
                    return 0;
                }
                if (source.Length == 0)
                {
                    return -1;
                }
                if (chars.Length == 0)
                {
                    return 0;
                }
                for (int i = 0; i < source.Length; i++)
                {
                    if (chars.IndexOf(source[i]) == -1)
                    {
                        return i;
                    }
                }
            }
            return -1;
        }

Usage Example

Exemple #1
0
        internal static bool ParseSearchString(string searchText, SearchFilter filter)
        {
            bool result;

            if (string.IsNullOrEmpty(searchText))
            {
                result = false;
            }
            else
            {
                filter.ClearSearch();
                string text = string.Copy(searchText);
                SearchUtility.RemoveUnwantedWhitespaces(ref text);
                bool flag = false;
                int  i    = SearchUtility.FindFirstPositionNotOf(text, " \t,*?");
                if (i == -1)
                {
                    i = 0;
                }
                while (i < text.Length)
                {
                    int num  = text.IndexOfAny(" \t,*?".ToCharArray(), i);
                    int num2 = text.IndexOf('"', i);
                    int num3 = -1;
                    if (num2 != -1)
                    {
                        num3 = text.IndexOf('"', num2 + 1);
                        if (num3 != -1)
                        {
                            num = text.IndexOfAny(" \t,*?".ToCharArray(), num3);
                        }
                        else
                        {
                            num = -1;
                        }
                    }
                    if (num == -1)
                    {
                        num = text.Length;
                    }
                    if (num > i)
                    {
                        string text2 = text.Substring(i, num - i);
                        if (SearchUtility.CheckForKeyWords(text2, filter, num2, num3))
                        {
                            flag = true;
                        }
                        else
                        {
                            filter.nameFilter = filter.nameFilter + ((!string.IsNullOrEmpty(filter.nameFilter)) ? " " : "") + text2;
                        }
                    }
                    i = num + 1;
                }
                result = flag;
            }
            return(result);
        }
All Usage Examples Of UnityEditor.SearchUtility::FindFirstPositionNotOf