What is the alternative of String.Contains() method in J2ME?
I want to compare if string1 "stack" i开发者_高级运维s in string2 "Welcome to stack overflow". How to achieve this in J2ME?
.contains() is worked for that. Why are you looking for alternative? But here is the same code which achieves if a string contains a substring;
if( string.indexOf("stack") >= 0 ) { // True
}else {
}
In anywhere of string
, that search the "stack" and returns true or false.
精彩评论