-
10. 루프(반복문)을 빠져 나오는 방법!program_language 및 궁금한것/Java 2019. 4. 22. 17:26
while문을 빠져 나오는 방법
return; <-- 메소드 종료
break; <-- switch와 반복문 종료
continue; <-- 반복문을 계속 진행한다.
for문(증감자를 거친 조건문), while(조건식으로), do~while(조건식으로)valid Check: 유효성 검사라고 한다.
validate
api문서에서 Deprecated가 있는것은 권장하지 않는다.라는 뜻이다.
api문서 참고 ~!
x The character x \\ The backslash character \0n The character with octal value 0n (0 <= n <= 7) \0nn The character with octal value 0nn (0 <= n <= 7) \0mnn The character with octal value 0mnn (0 <= m <= 3, 0 <= n <= 7) \xhh The character with hexadecimal value 0xhh \uhhhh The character with hexadecimal value 0xhhhh \x{h...h} The character with hexadecimal value 0xh...h (Character.MIN_CODE_POINT <= 0xh...h <= Character.MAX_CODE_POINT) \t The tab character ('\u0009') \n The newline (line feed) character ('\u000A') \r The carriage-return character ('\u000D') \f The form-feed character ('\u000C') \a The alert (bell) character ('\u0007') \e The escape character ('\u001B') \cx The control character corresponding to x [abc] a, b, or c (simple class) [^abc] Any character except a, b, or c (negation) [a-zA-Z] a through z or A through Z, inclusive (range) [a-d[m-p]] a through d, or m through p: [a-dm-p] (union) [a-z&&[def]] d, e, or f (intersection) [a-z&&[^bc]] a through z, except for b and c: [ad-z] (subtraction) [a-z&&[^m-p]] a through z, and not m through p: [a-lq-z](subtraction) . Any character (may or may not match line terminators) \d A digit: [0-9] \D A non-digit: [^0-9] \s A whitespace character: [ \t\n\x0B\f\r] \S A non-whitespace character: [^\s] \w A word character: [a-zA-Z_0-9] \W A non-word character: [^\w] \p{Lower} A lower-case alphabetic character: [a-z] \p{Upper} An upper-case alphabetic character:[A-Z] \p{ASCII} All ASCII:[\x00-\x7F] \p{Alpha} An alphabetic character:[\p{Lower}\p{Upper}] \p{Digit} A decimal digit: [0-9] \p{Alnum} An alphanumeric character:[\p{Alpha}\p{Digit}] \p{Punct} Punctuation: One of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ \p{Graph} A visible character: [\p{Alnum}\p{Punct}] \p{Print} A printable character: [\p{Graph}\x20] \p{Blank} A space or a tab: [ \t] \p{Cntrl} A control character: [\x00-\x1F\x7F] \p{XDigit} A hexadecimal digit: [0-9a-fA-F] \p{Space} A whitespace character: [ \t\n\x0B\f\r] String id = "jinsil1106"; // 아이디는 8~12자리 입니다. 영문자와 숫자 조합입니다. String idPattern = "[A-z0-9]{8,12}"; // 문자열 길이가 최소 8~12 // {8,12} 8이상 12 이하{8, }: 최소 8이상 {8} : 8번 System.out.println("아이디체크: " + id.matches(idPattern)); String juminBunho = "960309-3012345"; String juminPattern = "[\\d]{6}-[\\d]{7}"; // <-- \사용시 \\를 써주면 역슬래시로 봐준다. 아니라면 문자열로 봄 System.out.println("주민번호 체크: " + juminBunho.matches(juminPattern));
반응형'program_language 및 궁금한것 > Java' 카테고리의 다른 글
12. 예외처리(Exception) (0) 2019.04.23 11. 배열, 벡터 (0) 2019.04.22 9. 문자열의 인덱싱, 대소문자 무시비교 (0) 2019.04.22 [자바] equals 올바른 사용법 (0) 2019.04.19 [자바] NullPointerException 발생원인 (0) 2019.04.19