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

边栏推荐
- Fundamentals of C language -- similarities and differences between arrays and pointers
- Deep understanding Net (2) kernel mode 1 Kernel mode construct event event
- Message queue ten questions
- Super comprehensive redis distributed high availability solution: sentry mechanism
- ADB devices cannot detect the problem of Xiaomi note 3
- Visualization of provincial GDP with CSV metabase processing
- Flask Sqlalchemy - how to use custom query criteria ---orm (7)
- C language foundation - pointer array - initialization method & constant pointer array, pointer constant array
- Create a new MySQL database under Linux and import SQL files
- Map reduce case super detailed explanation
猜你喜欢

Message queue ten questions

linux下修改mysql密码: ERROR 1396 (HY000): Operation ALTER USER failed for ‘root‘@‘localhost‘

Four solutions to cross domain problems

4.4 string

Experiment of the planning group of the West University of technology -- pipeline CPU and data processing Adventure

Policy Center-Permissions and APIs that Access Sensitive Information
![[matlab] 3D drawing summary](/img/57/05156340ccdd79b866c4df955b3713.jpg)
[matlab] 3D drawing summary
![Warning: [antd: Menu] `children` will be removed in next major version. Please use `items` instead.](/img/c1/99ad29789a669c4498fb93ce1fb009.png)
Warning: [antd: Menu] `children` will be removed in next major version. Please use `items` instead.

Oculus quest2 | unity configures the oculus quest2 development environment and packages an application for real machine testing

RTC monthly tabloid programming challenge ended successfully in June; Review of the first anniversary of sound network's listing
随机推荐
My own opinion on lisp
[ten thousand words long article] thoroughly understand load balancing
开源 STM32 USB-CAN项目
4.3 variables and assignments
Google Play 索引表
G - navigation nightare
Guada digital analog
Kindle倒下,iReader接力
Advanced functions of ES6 operation array map (), filter (), reduce()
What would you choose between architecture optimization and business iteration?
Introduction to using 51 single chip microcomputer to control steering gear
Container common commands
Abstract meaning
Policy Center > Deceptive Behavior
Model system: Sword (1)
A little idea about big experiment data
Imeta | Ye Mao / Shi Yu reviewed the dynamic shuttle and ecological function of intracellular and extracellular genes in the environmental microbiome
Pointer understanding
ADB devices cannot detect the problem of Xiaomi note 3
Advanced C language - pointer 3 - knowledge points sorting