public static String pluralize ( String word ) { if ( word == null ) { throw new IllegalArgumentException ( ) ; } final String lowerCaseWord = word . toLowerCase ( ) ; if ( endsWithAny ( lowerCaseWord , "s" , "sh" , "o" ) ) { return word + "es" ; } if ( lowerCaseWord . endsWith ( "y" ) && ! lowerCaseWord . endsWith ( "ay" ) || endsWithAny ( lowerCaseWord , "ey" , "oy" , "uy" ) ) { return word . substring ( 0 , word . length ( ) - 1 ) + "ies" ; } else { return word + "s" ; } }
Get the plural for the given English word .