当前位置:网站首页>输入字符串,替换其中敏感词进行输出
输入字符串,替换其中敏感词进行输出
2022-08-11 05:12:00 【余谦吖】
例:字符串“打劫!我有枪”,“枪”是敏感词汇,替换为“*”,并输出打印
package Day0712;
import java.util.Scanner;
public class one {
public static void main(String[] args) {
//输入
Scanner sc = new Scanner(System.in);
//设置敏感词汇
String mg = "枪";
//设置输入类型为string
String say = sc.next();
//匹配字符串中是否含有敏感词汇
if (say.contains(mg)){
//设置敏感词汇替换
String temp = "*";
//敏感词汇替换后输出
say = say.replace(mg,temp);
}
System.out.println(say);
}
}
边栏推荐
- redis集群模式--解决redis单点故障
- Kong implements ban on foreign IP access
- 报表控件Stimulsoft报告中的数据矩阵条形码介绍
- Internet Protocol 1
- Switch and Router Technology-29-OSPF Virtual Link
- 2022年Android面试中最常问的问题是什么?
- Oracle中如何用一个表的数据更新另一个表中的数据_转载
- [FPGA tutorial case 49] Control case 1 - FPGA-based PID controller verilog implementation
- IDEA使用记录
- Tips to make your code more and more taller and taller - code specification, you have to know
猜你喜欢

Thymeleaf

Switches and routers technology - 26 - configure OSPF peripheral area

【ARM】rk3399挂载nfs报错

HAVE FUN | “SOFA 星球”飞船计划、源码解析活动最新进展

Switch and Router Technology - 32 - Named ACL

【嵌入式开源库】MultiButton的使用,简单易用的事件驱动型按键驱动模块

代码在线审查(添加网页批注)的实现

Redis details

Switches and routers technology - 24 - configure OSPF single area

The use of async (asynchronous) and await
随机推荐
每周推荐短视频:你常用的拍立淘,它的前身原来是这样的!
金仓数据库 KingbaseGIS 使用手册(6.10. 几何对象操作运算符)
绿盾加密如何顺利切换成IP-Guard加密
Zabbix builds enterprise-level monitoring and alarm platform
How to read a paper
oracle tablespace and user creation
MFC Interprocess Communication (Shared Memory)
Win10远程连接(实现多用户同时连接)
leetcode 9. Palindromic Numbers
项目实战第二十七讲:状态模式在重名品牌中的应用
BitLocker的解密
Delphi7学习记录-demo实例
玩转mysql之查看mysql版本号
【嵌入式开源库】MultiTimer 的使用,一款可无限扩展的软件定时器
Weekly recommended short video: your commonly used Polaroid, its predecessor turned out to be like this!
MySQL存储引擎概念
C statement: data storage
Paper Notes: Bag of Tricks for Long-Tailed Visual Recognition with Deep Convolutional Neural Networks
HAVE FUN | "SOFA Planet" spacecraft plan, the latest progress of source code analysis activities
[Embedded open source library] The use of cJSON, an efficient and streamlined json parsing library