StringUtilities.java 500B

12345678910111213141516171819202122232425
  1. import java.util.*;
  2. public class StringUtilities {
  3. public Character getMiddleCharacter(String word)
  4. {
  5. return word.charAt(word.length()/2);
  6. }
  7. public String removeCharacter(String value, char charToRemove)
  8. {
  9. String s = "";
  10. s= s+charToRemove;
  11. String str ="";
  12. str=value.replaceAll(s,"");
  13. return str;
  14. }
  15. public String getLastWord(String value)
  16. {
  17. String str= value.substring(value.lastIndexOf(" ")+1);
  18. return str;
  19. }
  20. }