CodenameOne how do I check if a string contains a substring

Viewed 193

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?

1 Answers
Related