Ejemplo n.º 1
0
 /** Returns {@code true} if it leads to the automatic end of a token. */
 public static boolean isTerminator(char c) {
   return isOperator(Character.toString(c))
       || Character.isWhitespace(c)
       || isPunctuation(c)
       || c == ']'
       || c == ')';
 }
Ejemplo n.º 2
0
 /** Returns {@code true} if {@code c} is in the set {@code "AEIOUaeiou"}. */
 public static boolean isVowel(char c) {
   c = Character.toLowerCase(c);
   return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
 }
Ejemplo n.º 3
0
 /** Makes the first character in the given sentence uppercase. */
 public static String uppercase(String sent) {
   if (sent.length() == 0) return "";
   return Character.toUpperCase(sent.charAt(0)) + sent.substring(1);
 }
Ejemplo n.º 4
0
 /**
  * Returns {@code true} if the first letter in the given word is a vowel.
  *
  * <p>Note that this will return {@code true} for things like {@code (array of number)}.
  */
 private static boolean startsWithVowel(String word) {
   for (int i = 0; i < word.length(); i++)
     if (isVowel(word.charAt(i))) return true;
     else if (Character.isAlphabetic(word.charAt(i))) return false;
   return false;
 }