Java String Starts Wtih startsWithVowel(String value)

Here you can find the source of startsWithVowel(String value)

Description

Check to see if the string starts with a vowel.

License

Open Source License

Parameter

Parameter Description
value String to check

Return

true if value starts with a, e, i, o, or u (but not sometimes y). Check is case insensitive.

Declaration

public static boolean startsWithVowel(String value) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from   w  ww .j  a  v a 2  s. c om*/
     * Check to see if the string starts with a vowel.
     *
     * @param value String to check
     * @return true if value starts with a, e, i, o, or u (but not sometimes y).
     *         Check is case insensitive.
     */
    public static boolean startsWithVowel(String value) {
        if ((value == null) || value.equals("")) {
            return false;
        }
        char lower = Character.toLowerCase(value.charAt(0));
        return (lower == 'a') || (lower == 'e') || (lower == 'i')
                || (lower == 'o') || (lower == 'u');
    }
}

Related

  1. startsWithUppercase(String str)
  2. startsWithUpperCase(String text)
  3. startsWithURIScheme(String arg)
  4. startsWithVowel(String string)
  5. startsWithVowel(String text)
  6. startsWithVowel(String word)
  7. startsWithWeight(String s1, String s2)
  8. startsWithWhitespace(final CharSequence charSeq)
  9. startsWithWhitespace(String s)