当前位置:网站首页>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

边栏推荐
- 1027 colors in Mars (20 points)
- NPM install --global --save --save dev differences
- A little idea about big experiment data
- (Niuke) BFS
- About pickle module - 6 points that beginners must know
- Policy Center > Misrepresentation
- 1148 werewolf - Simple Version (20 points)
- iMeta | 叶茂/时玉等综述环境微生物组中胞内与胞外基因的动态穿梭与生态功能...
- Oculus quest2 | unity configures the oculus quest2 development environment and packages an application for real machine testing
- Scattered knowledge of C language (unfinished)
猜你喜欢

Advanced functions of ES6 operation array map (), filter (), reduce()

阿里云oss对象存储跨域设置

RTC monthly tabloid programming challenge ended successfully in June; Review of the first anniversary of sound network's listing

Data governance Market: Yixin Huachen faces left, Huaao data faces right

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

Basic literacy - four common software architectures

消息队列十连问

Npumcm selection question 3 and acmc2020a

Policy Center > Misrepresentation

Compare whether the two arrays are the same
随机推荐
4.6 floating point number
How to do a good job in high concurrency system design? I have summarized three points
My own opinion on lisp
Technology sharing | how to quickly realize audio and video online calls
O - ACM contest and blackout (minimum spanning tree, Kruskal)
1150 traveling salesman problem (25 points)
[leetcode] linked list sorting (gradually increasing the space-time complexity)
Summary of gradient descent optimizer (rmsprop, momentum, Adam)
Scattered knowledge of C language (unfinished)
Chapter 2 installation and use of vscode editor
Data governance Market: Yixin Huachen faces left, Huaao data faces right
【Leetcode】链表排序(逐步提高时空复杂度)
1019 general palindromic number (20 points)
Basic literacy - four common software architectures
Bye civil engineering, hello CS, can you change the certificate to the Blue Bridge Cup
Flask Sqlalchemy - how to use custom query criteria ---orm (7)
001 data type [basic]
Talk about why I started technical writing
The short video and live broadcast incubation training camp with goods opens nationwide enrollment!
J - Borg maze (minimum spanning tree +bfs)