728x90
반응형
가끔 이런것이 필요할 때가 있다.
userId 를 USER_ID 로 바꾸는 기능.
- public class Test {
- public static void main(String[] args) throws Exception {
- String regex = "([a-z])([A-Z])";
- String replacement = "$1_$2";
- String str = "UserId";
- String value = "";
- value = str.replaceAll(regex, replacement).toUpperCase();
- System.out.println(value);
- }
- }
728x90
반응형
'Development > Java' 카테고리의 다른 글
Meta Annotaion (0) | 2013.07.01 |
---|---|
Type-Safe Code란? (0) | 2013.06.25 |
Fileld명을 테이블 컬럼명으로 바꾸자 (0) | 2013.04.06 |
Tomcat 구동시 라이브러리를 못찾을 경우.. (0) | 2013.03.29 |
ExecutorService (0) | 2013.03.22 |
오버라이딩 규칙 (0) | 2013.02.12 |
댓글0