Here you can find the source of startWithAorAn(String str)
public static String startWithAorAn(String str)
//package com.java2s; //License from project: Apache License public class Main { public static String startWithAorAn(String str) { if (str.length() == 0) return str; if ((!str.toUpperCase().startsWith("A ")) && (!str.toUpperCase().startsWith("AN ")) && (!str.toUpperCase().startsWith("THE ")) && (!str.toUpperCase().startsWith("SOME "))) { if ("aeiouAEIOU".indexOf(str.charAt(0)) >= 0) return "an " + str; return "a " + str; }//from w w w . j a v a 2 s. c om return str; } }