일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- oracle
- 프로그래머스
- 구글로그인
- python
- SQL
- 스프링부트 채팅서버
- kotlin 클래스
- springboot
- mysql
- javascript
- MSA
- 스프링시큐리티
- 스프링부트
- pygame
- js
- oauth2
- 코틀린 클래스
- Leetcode
- java8
- sap ERP
- SQL프로그래머스
- 자바스크립트
- 스프링
- spring boot
- SAP ABAP
- Spring
- 오라클
- SQL 문제풀이
- 자바 스트림
- LeetCode SQL
Archives
- Today
- Total
목록java 휴대폰번호 가운데 마스킹 (1)
웅겹살의 프로그래밍 삼매경

public static String phoneMasking(String phoneNo) throws Exception { String regex = "(\\d{2,3})-?(\\d{3,4})-?(\\d{4})$"; Matcher matcher = Pattern.compile(regex).matcher(phoneNo); if(matcher.find()) { String target = matcher.group(2); int length = target.length(); char[] c = new char[length]; Arrays.fill(c, '*'); return phoneNo.replace(target, String.valueOf(c)); } return phoneNo; }
자바(java)
2023. 2. 17. 09:23