Java program to remove the all symbols from given string.

REMOVE all SYMBOLS from given string.

 


                                                                                        We have created java program that will remove all types of special characters or symbols we find in any string. All alphabets and all numbers will be ignored but symbols will be removed from given string. We hope you will like this program. 




JAVA Code :) 




import java.util.Scanner;


public class string



public static void main(String[] args)  



Scanner sc=new Scanner(System.in);


System.out.println("Enter any String:");


String str= sc.nextLine();


String resultStr=""; 


for (int i=0;i<str.length();i++) 



if (str.charAt(i)>=65 && str.charAt(i)<=122 ||str.charAt(i)==32 || str.charAt(i)>=48 && str.charAt(i)<=57)



resultStr=resultStr+str.charAt(i); 




sc.close();


System.out.print(resultStr); 



}




 INPUT && OUTPUT :)



Post a Comment

0 Comments