[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Count the occurrence of word in text/String

  • Thread starter Thread starter Thierry Ciot
  • Start date Start date
Status
Not open for further replies.
T

Thierry Ciot

Guest
To count instances of strings, you can use the following as suggested here stackoverflow.com/.../22566637 String in = "i have a male cat. the color of male cat is Black"; int i = 0; Pattern p = Pattern.compile("male cat"); Matcher m = p.matcher( in ); while (m.find()) { i++; } System.out.println(i); // Prints 2 Of course you would put this code in an extended operator as suggested earlier. Thierry

Continue reading...
 
Status
Not open for further replies.
Back
Top