当前位置:网站首页>Phone number shielding function
Phone number shielding function
2022-06-30 15:40:00 【Frog claw white】
demand
Enter a mobile phone number with the keyboard , Block the middle four digits , The final effect is :
analysis
① Enter a string on the keyboard .
② Call the interception of string object API, Intercept the first three bits of the string 、 The last four .
③ Top three Connect “****” Then continue to connect the last four digits , Just output the final result .
Code
package com.xxf1.string;
import java.util.Scanner;
/* * Mobile phone number shielding * */
public class StringDemo3 {
public static void main(String[] args) {
//1、 Enter the phone number on the keyboard
Scanner sc = new Scanner(System.in);
System.out.println(" Please enter your mobile number :");
String tel = sc.next();
//2、 Intercept the first three and last four digits of the number
String before = tel.substring(0, 3);
String after = tel.substring(7);
String s = before + "****" + after;
System.out.println(s);
}
}
test

边栏推荐
- 1025 pat ranking (25 points)
- Jupyter notebook basic knowledge learning
- 深入理解.Net中的线程同步之构造模式(二)内核模式1.内核模式构造物Event事件
- How should we understand the variability of architecture design?
- 4.12 input() input function and comments
- 1058 a+b in Hogwarts (20 points)
- Flask Sqlalchemy - automatically export the table model (flask sqlacodegen) & no single primary key problem ---orm (8)
- 1035 password (20 points)
- 1150 traveling salesman problem (25 points)
- Scattered knowledge of C language (unfinished)
猜你喜欢

How to do a good job in high concurrency system design? I have summarized three points

How to browse mobile web pages on your computer

各省GDP可视化案列,附带csv Metabase处理

Advanced C language - pointer 3 - knowledge points sorting

Practical cases of data visualization (timeline rotation diagram, streamlit control year metabase visualization tutorial) 2.0

4.4 string

Policy Center > Google Play‘s Target API Level Policy

Developer practice - the future of Agora home AI audio and video

The principle of fluent 2 rendering and how to realize video rendering

Anyrtc implements application scenarios based on webrtc
随机推荐
Bye civil engineering, hello CS, can you change the certificate to the Blue Bridge Cup
Review 2021, embrace change and live up to Shaohua
The principle of fluent 2 rendering and how to realize video rendering
数数据可视化实战案例(timeline轮播图,streamlit 控件年份 metabase可视化使用教程)2.0
[matlab] 2D drawing summary
4.3 variables and assignments
openresty 内置变量
1025 pat ranking (25 points)
Mysql database - create user name & modify permission
001 basic knowledge (unfinished)
Visualization of provincial GDP with CSV metabase processing
1149 dangerous goods packaging (25 points)
Pycharm----xx. So cannot open shared object file problem solving
Introduction to using 51 single chip microcomputer to control steering gear
Data governance Market: Yixin Huachen faces left, Huaao data faces right
Policy Center > Malware > Malware
G - building a space station
Fundamentals of C language -- similarities and differences between arrays and pointers
linux下新建Mysql数据库并导入sql文件
B. Moamen and k-subarrays (codeforce+ binary search)