I want to write a java method that takes a string as word and that method will decide if the word is singular or plural.
For example:
- Bus is Singular, Buses is Plural
- Dog is Singular, Dogs is Plural
I tried to do something like this:
public static boolean isPlural( String word ) {
boolean flag = true;
//the problem is that most words ending with s are not actually plural, like: Status
if( word.endsWith("s") || word.endsWith("es") ) {
flag = true;
} else {
flag = false;
}
return flag;
}
This method works in few cases like Buses, Dishes, cabins etc. But it will fail in status, sparcatus, Mess, creates etc
Thank you.