List of usage examples for org.apache.commons.lang CharSet getInstance
public static CharSet getInstance(String setStr)
Factory method to create a new CharSet using a special syntax.
null
or empty string ("") - set containing no charactersThe matching order is:
Matching works left to right.
From source file:MainClass.java
public static void main(String[] args) { //Create a new vowel character set CharSet vChs = CharSet.getInstance("aeiou"); String strTest = "The quick brown fox jumps over the lazy dog."; int iVowelCnt = 0; int iTestLen = strTest.length(); for (int i = 0; i < iTestLen; i++) { if (vChs.contains(strTest.charAt(i))) { iVowelCnt++; //increment count on a vowel being found }//from ww w . j ava 2 s .co m } System.out.println("String >>" + strTest); System.out.println("Number of vowels in the string is " + iVowelCnt); }
From source file:CharSetExampleV1.java
public static void main(String args[]) { CharSet set = CharSet.getInstance("the apprentice"); System.err.println(set.contains('q')); CharRange[] range = set.getCharRanges(); System.err.println(ArrayUtils.toString(range)); }
From source file:VowelCharSetTrial.java
public static void main(String[] args) { // Create a new vowel character set CharSet vChs = CharSet.getInstance("aeiou"); String strTest = "The quick brown fox jumps over the lazy dog."; int iVowelCnt = 0; int iTestLen = strTest.length(); for (int i = 0; i < iTestLen; i++) { if (vChs.contains(strTest.charAt(i))) { iVowelCnt++; // increment count on a vowel being found }/*from w ww. ja va2 s .com*/ } System.out.println("String >>" + strTest); System.out.println("Number of vowels in the string is " + iVowelCnt); }