Hi I have to compute if a given string is substring of a bigger string. For example
String str = "Hallo my world";
String substr = "my"
The method "contains" should return true because str contains substr (false otherwise).
I was looking for something like "contains" at the String class but I didn't find it. I suppose that the only solution is to use pattern matching. If this is the case which would be the better (cheapest) way to do this?
Thanks!
here is a general method that you can use
You can use .substring(int beginIndex,int lastIndex) to check this program. Sample code goes as below:-
Go through this method. visit for tricky code