H
Harold-Jan Verlee
Guest
There is no specific STRING operator which does this today. However, it would be quit easy to create a custom Extended Operator ( see documentation ) . Java code which could be used to write this ExtOps would look like as follows (you would return the count in the function and your Entity.Attribute(string) would be the input): // Java program to count the number of occurrence of a word in a given string // import java.io.*; class GFG { static int countOccurences(String str, String word) { // split the string by spaces in a String a[] = str.split(" "); // search for pattern in a int count = 0; for (int i = 0; i < a.length; i++) { // if match found increase count if (word.equals(a)) count++; } return count; } See: Geeks .
Continue reading...
Continue reading...