Java replace() method: string replacement
•
Java
Grammar 1
replace(char oldChar,char newChar);
Example
String str = "C语言中文网"; str = str.replace("C语言中文网","C语言编程词典");
Grammar 2
public String replace(CharSequence target,CharSequence replacement)
Example
String str = "nnn"; str = str.replace("nn","m");
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码