Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
このコード行が機能しないのはなぜですか? すべての句読点を何も置き換えないことになっています。
m = m.replace("[\\?\\.;:'\"]", "")
句読点が含まれていても、Java でこの行を実行した後、m は変更されません。なんで?
これは、 ;replaceがかかるためです。Stringを呼び出す必要がありますがreplaceAll、これは正規表現を取ります。
replace
String
replaceAll