1234567891011121314151617181920212223242526272829303132 |
- public class StringUtilities {
- public Character getMiddleCharacter(String word){
- int middle = word.length();
- int x;
- char m = 0;
-
- if(middle % 2 == 0){
- x = middle / 2 - 1;
- m = word.charAt(x);
- }else if (middle % 2 != 0){
- x = middle / 2;
- m = word.charAt(x);
- }
- return m;
- }
-
- public String removeCharacter(String value, char charToRemove){
- // String newestword = value.replaceAll(charToRemove,"");
- //return newestword;
- return null;
-
- }
-
- public String getLastWord(String value) {
-
- String [] container = value.split(" ");
- String x = container[container.length -1];
- return x;
-
- }
- }
|