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.
正規表現を使用して、スペース " "、ドット "."、ダッシュ "-"、"The" などの文字列の不要な文字をすべて削除しようとしています。
「ダークナイト ライジング」のように。そして「DarkKnightRises」を出力
これは私が得た限りです
.replaceAll("\\s+", "")
私は完全な初心者です。
アイデア?
ありがとう
以下を使用できます。
String str = "The Dark-Knight Rises."; String repl = str.replaceAll("(?i)[ .-]+|\\bthe\\b", ""); //=> DarkKnightRises