以基本字串中的取代字串取代所有符合目標字串的發生次數。
從字串開始到結束的取代,例如,在字串"aaa"中以"b"取代"aa"將產生"ba",而非"ab"。
String
replaceAll(<parameters>)
參數 | 類型 |
---|---|
base | 字串 |
目標 | 字串 |
替換 | 字串 |
replaceAll(<baseString>,<sourceString>,<replacementString>)
傳回字串。
replaceAll("Hello World", "l", "x")
傳回"Hexxo Worxd"。