Removing whitespace from strings in Java

前端 未结 30 2239
一个人的身影
一个人的身影 2020-11-22 05:01

I have a string like this:

mysz = \"name=john age=13 year=2001\";

I want to remove the whitespaces in the string. I tried trim()

30条回答
  •  不要未来只要你来
    2020-11-22 05:29

    private String generateAttachName(String fileName, String searchOn, String char1) {
        return fileName.replaceAll(searchOn, char1);
    }
    
    
    String fileName= generateAttachName("Hello My Mom","\\s","");
    

提交回复
热议问题