Notice
Recent Comments
Link
Tags
- Python
- index 생성
- 우분투 시간변경
- Node.js express install
- node 버전확인
- java 숫자를 문자로 변환하기
- express install
- C언어
- 파이썬 반복문
- mysql index 생성
- Ubuntu timezone
- c file read
- 클라우드서버 생성
- ubuntu node js install
- tzselect
- 자바 파일 한줄씩 읽기
- 디지털오션 드로플릿
- c언어 파일 읽기
- 우분투 시간설정
- 라즈베리파이4
- npm버전확인
- 디지털오션 클라우드서버 생성하기
- node js express install
- ubuntu node js
- 디지털오션 서버생성하기
- raspi-config
- node js 버전확인
- 파이썬
- 우분투 node js 설치
- 자바 한줄씩 읽기
Archives
- Today
- Total
호그래머
자바 문자열 한글 체크하기 정규화 방법1(Java regex) 23.06.14 본문
728x90
1. 자바 문자열 한글체크 하기 - regex
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class tistory_java_230614 {
public static void main(String[] args) {
String text = "가나AA다1234";
String regex = "[\\p{IsHangul}]+";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(text);
if (matcher.find()) {
System.out.println("문자열에 한글 있음.");
} else {
System.out.println("문자열에 한글 없음.");
}
}
}
결과
문자열에 한글 있음.
끝
1. 자바에서 쉽게 정규화를 이용하여 문자열 속에 한글이 있는지 체크 할 수 있다.
728x90
'Java' 카테고리의 다른 글
자바 ArrayList 사용하기 23.06.29 (0) | 2023.06.29 |
---|---|
자바 숫자를 문자로 변환하기 23.06.29 (0) | 2023.06.29 |
자바 문자열 공백 제거(Java String replace,trim) 23.06.13 (0) | 2023.06.13 |
자바 폴더 만들기(Java make directory) 21.01.04 (0) | 2021.01.05 |
자바 날짜, 시간 표현(JAVA Date, Time) 21.01.04 (0) | 2021.01.04 |
Comments