입력받은 전화번호 등에서 하이픈이나 스페이스 같은 필요없는 문자를 제거할 때 사용하자

public class Test1 {

    public static void main(String[] args) {

        String test = "!@#$@#826 $@#1%$%7 98$asd87 9f320qepu as dfkjl321";
        System.out.println(test.replaceAll("[\\D]",""));
        System.out.println(test.replaceAll("\\D",""));
        System.out.println(test.replaceAll("[^\\d]",""));
        System.out.println(test.replaceAll("^\\d",""));

    }
}

 

결과

 

regex101.com/r/FIXIWL/1/

 

Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript

Please wait while the app is loading...

regex101.com

 

 

참고

https://blog.naver.com/getinthere/221841916039

 

Springboot 28강 - 리플렉션을 이용한 DI구현하기

https://dublin-java.tistory.com/53​

blog.naver.com

 

어노테이션 생성

 

더미 클래스 생성

 

메소드의 어노테이션을 확인하여

값을 미리 처리해본후 문제가 발생하면 널 아니면 객체를 전달하도록 세팅

 

invokeAnnotation에서 확인한 머니객체를 리턴

 

 

 

 

 

 

 

 

 

 

 

 

 

변수명 첫글자에 대문자가 들어가면 파싱이 되지 않는다

 

URLEcoder.encode를 사용하자

 

+ Recent posts