You need to sign in to do that
Don't have an account?
Ankit Khiwansara 10
Scan substring in String
Hello,
Could you please help me how to scan substring within the string.
Scanned String - Ankit
Example - My Name is Ankit -- Search found and answer should be True or Ankit.
Example - My Name is Ankita -- Search not found (As user searching for Ankit not Ankita) and answer should be False.
I am trying to use indexOfIgnoreCase(string) , but this is failing in second scenario.
Could you please help me how to scan substring within the string.
Scanned String - Ankit
Example - My Name is Ankit -- Search found and answer should be True or Ankit.
Example - My Name is Ankita -- Search not found (As user searching for Ankit not Ankita) and answer should be False.
I am trying to use indexOfIgnoreCase(string) , but this is failing in second scenario.
You can simply use predefine string method which solve your question in just one line.
Try the above code. I hope you find the solution helpful. If it does, please mark as Best
Answer to help others too.
Thanks,
Ajay Dubedi