StringUtilities.java 569B

1234567891011121314151617181920212223
  1. public class StringUtilities {
  2. public Character getMiddleCharacter(String word){
  3. return word.charAt(word.length() /2);
  4. }
  5. public String removeCharacter(String value, char charToRemove){
  6. String newValue = "";
  7. for (int i = 0; i < value.length(); i++) {
  8. if (value.charAt(i) != charToRemove) {
  9. newValue += value.charAt(i);
  10. }
  11. }
  12. return newValue;
  13. }
  14. public String getLastWord(String value) {
  15. return value.substring(value.lastIndexOf(" ") +1);
  16. }
  17. }