Custom Contains

 avatar
unknown
csharp
3 years ago
602 B
4
Indexable
        public static bool CustomContains(this string value, string searchValue)
        {
            int valueCount = 0;
            for (int i = 0; i < value.Length; i++)
            {
                for (int j = valueCount; j < searchValue.Length; j++)
                {
                    if (value[i] == searchValue[j])
                        valueCount++;

                    if (valueCount == searchValue.Length)
                        return true;
                    else
                        break;
                }
            }
            return false;
        }
Editor is loading...