Remove character in a given string

class RemoveChar{
public static void main(String args[]){
String val=removeChar("Madhusudhan Reddy",'u');
System.out.println(val);
}



public static String removeChar(String s, char c) {

   String r = "";

   for (int i = 0; i < s.length(); i ++) {
      if (s.charAt(i) != c) r += s.charAt(i);
   }

   return r;
}
}

Comments

Popular posts from this blog

Android Objective type Question and Answers

Android Questions and Answers for written exams

Core Java -----Question and Answers