Java replace all square brackets in a string

前端 未结 7 1075
执笔经年
执笔经年 2020-12-02 11:20

I want to remove square brackets from a string, but I don\'t know how.

String str = \"[Chrissman-@1]\";
str = replaceAll(\"\\\\[\\\\]\", \"\");

String[] tem         


        
相关标签:
7条回答
  • 2020-12-02 11:53
    String str, str1;
    Scanner sc = new Scanner(System.in);
    
    System.out.print("Enter a String : ");
    str = sc.nextLine();
    
    
    str1 = str.replaceAll("[aeiouAEIOU]", "");
    
    
    
    System.out.print(str1);
    
    0 讨论(0)
提交回复
热议问题