CharSetUtils: count(String str, String[] set) (2) : CharSetUtils « org.apache.commons.lang « Java by API






CharSetUtils: count(String str, String[] set) (2)

/*
B and o count = 3
B,o,k,e and r count = 8 
 */
import org.apache.commons.lang.CharSetUtils;

public class CharSetUtilsTrial {
  public static void main(String[] args) {
    // Count all occurrences of all the characters specified.
    System.out.println("B and o count = " + CharSetUtils.count("BorisBecker", "Bo")); // 3
    System.out.println("B,o,k,e and r count = "
        + CharSetUtils.count("BorisBecker", new String[] { "Bo", "ker" })); // 8

  }
}

           
       








Apache-Common-Lang.zip( 248 k)

Related examples in the same category

1.CharSetUtils: count(String str, String set)
2.CharSetUtils: delete(String str, String set)
3.CharSetUtils: delete(String str, String[] set) (2)
4.CharSetUtils: keep(String str, String set)
5.CharSetUtils: squeeze(String str, String set)