remove special character from String
Q ) Remove Special Character from String.
public class HelloWorld{
public static void main(String []args){
String file = "Good Morning! Mr. James Potter. Had your breakfast?";
String remove ="";
for(int i =0 ;i<file.length();i++){
char a = file.charAt(i);
if(a=='!' || a== '.' || a=='?'){
}else{
remove = ""+ a;
System.out.print(remove);
}
}
}
}
Comments
Post a Comment