remove substring in a string without using regex (cannot use replaceAll)

前端 未结 5 1757
深忆病人
深忆病人 2021-01-28 04:32

I need to remove some substrings in strings (in a large dataset). The substrings often contain special characters, like these: ., ^, /,... and replaceAll() would treat them as s

5条回答
  •  萌比男神i
    2021-01-28 04:52

    Just use String.replace(String, String), not replaceAll. String.replace doesn't treat its argument as a regex.

提交回复
热议问题