import java.util.Scanner;
public class StringTest5 {
/**
* 键盘录入一个字符串,如果里面包含(TMD),用***替换
*/
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("请输入字符串:");
String s=sc.nextLine();
String result=s.replace("TMD","***");
System.out.println(result);
}
}
标签:Scanner,System,result,字符串,out,替换,String
From: https://blog.51cto.com/u_15988249/6252739