CharSetUtils.count : CharSetUtils « Apache Common « Java Tutorial






import org.apache.commons.lang.CharSetUtils;

public class MainClass {
  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"));
    System.out.println("B,o,k,e and r count = " +
        CharSetUtils.count("BorisBecker", new String[] { "Bo", "ker" }));

  }
}
B and o count = 3
B,o,k,e and r count = 8
  Download:  CommonLangCharSetUtils.count.zip( 199 k)







37.15.CharSetUtils
37.15.1.CharSetUtils.squeeze
37.15.2.CharSetUtils.keep
37.15.3.CharSetUtils.delete
37.15.4.CharSetUtils.count
37.15.5.Build Equals With EqualBuilder