123456789101112131415161718192021 |
- public class StringUtilities {
- public Character getMiddleCharacter(String word){
- if ((word.length() % 2) == 0) {
- return word.charAt(((word.length()/2)));
- } else return word.charAt((word.length()/2));
- }
-
- public String removeCharacter(String value, char charToRemove){
- String s = "";
- s = s + charToRemove;
- String str = "";
- str = value.replaceAll(s,"");
- return str;
- }
-
- public String getLastWord(String value) {
- String lastWord = value.substring(value.lastIndexOf(" ")+1);
- return lastWord;
- }
- }
|