1234567891011121314151617181920212223242526272829303132 |
- public class StringUtilities {
- public Character getMiddleCharacter(String word){
- int position;
- String middleChar;
- position = (word.length()/2);
- return (word.substring(position,position+1)).charAt(0);
- }
-
- public String removeCharacter(String value, char charToRemove){
- char[] chars=value.toCharArray();
- String str="";
- for(int i=0;i<chars.length;i++){
- if (chars[i]==charToRemove) {
- continue;}
- else{
- str+=chars[i];
- }
- }
- return (str);
- }
-
-
-
-
-
- public String getLastWord(String value) {
-
- String strArr[] = value.split(" ");
- return strArr[strArr.length-1];
- }
- }
|