Java: Remove full stop in string

后端 未结 5 1434
死守一世寂寞
死守一世寂寞 2021-01-18 23:34

I want to delete all the full stops ( . ) in a string.

Therefore I tried: inpt = inpt.replaceAll(\".\", \"\");, but instead of deleting only the full st

5条回答
  •  生来不讨喜
    2021-01-19 00:09

    replaceAll takes a regular expressions as an argument, and . in a regex means "any character".

    You can use replace instead:

    inpt = inpt.replace(".", "");
    

    It will remove all occurences of ..

提交回复
热议问题