Reputation: 3411
In "normal" Java I can use the following method to find out if a string contains a substring:
String string = "hello new world";
String subString = "new";
if (string.contains(subString)) {
System.out.println("has string");
}
The same does not work in Codename One. Googeling around I saw a suggestion to use (what I couldn't get working):
string.indexOf
How would I perform this simple operations in Codename One?
Upvotes: 3
Views: 201
Reputation: 7483
You can check that by calling:
if (new CN1String(string).contains(subString)) {
System.out.println("has string");
}
Upvotes: 2