when enter the text to find the string i want to ignore the case how to implement that in a context below

public override void Search()
        {
            
            //file = new FileStream(@"C:\username.txt", FileMode.Open, FileAccess.Read);
            
            Console.WriteLine("Input a string ");
            String data = Console.ReadLine();
            sr = File.OpenText(@"C:\username.txt");
            String st = sr.ReadToEnd();
           // How to implement ignore cases 
            
                if (st.Contains(data))
                {
                    Console.WriteLine("Found at position :" + st.IndexOf(data));
                }
                else
                {
                    Console.WriteLine("Not Found");
                }

Thanks,

You can do something like this:

if (st.ToLower().Contains(data.ToLower()))

Thanks a million but i got some other solution. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.