[Solved] Searching a String using C#


If you’re a masochist you can do this old school VB3 style:

        string input = @"</script><div id='PO_1WTXxKUTU98xDU1'><!--DO NOT REMOVE-CONTENTS PLACED HERE--></div>";
        string startString = "div id='";

        int startIndex = input.IndexOf(startString);

        if (startIndex != -1)
        {
            startIndex += startString.Length;
            int endIndex = input.IndexOf("'", startIndex);
            string subString = input.Substring(startIndex, endIndex - startIndex);
        }

solved Searching a String using C#