Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 핸드폰번호
- invisible
- Kotlin
- Android
- Var
- 4대컴포넌트
- ExoPlayer2
- 안드로이드
- 비밀번호
- Visible
- ExoPlayer
- 자바
- 버튼 투명화
- Val
- Button
- FullScreen
- Regex
- 회원가입
- 전체화면
- 유효성 검사
- SharedPreference
- Gone
- 면접준비
- call by reference
- 생명주기
- 상수
- 변수
- 코틀린
- 휴대전화
- call by value
Archives
- Today
- Total
천천히 , 강하게 멀리
코틀린 유효성 검사 본문
//이메일 유효성
if (!Patterns.EMAIL_ADDRESS.matcher(editEmail.text.toString()).matches()) {
Toast.makeText(this, "이메일 형식이 아닙니다", Toast.LENGTH_SHORT).show()
editEmail.requestFocus()
}
// 비밀번호 유효성
val passMatches = Regex("^(?=.*[a-zA-Z0-9])(?=.*[!@#\$%^*+=-]).{8,20}$")
if (!editPassword.text.toString().matches(passMatches)){
Toast.makeText(this, "올바른 비밀번호가 아닙니다.", Toast.LENGTH_SHORT).show()
editPassword.requestFocus()
}
//핸드폰번호 유효성
val phoneMatches = Regex("^01[016789][0-9]{3,4}[0-9]{4}$")
if (!editPhone_number.text.toString().matches(phoneMatches)) {
Toast.makeText(this, "올바른 핸드폰 번호가 아닙니다.", Toast.LENGTH_SHORT).show()
editPhone_number.requestFocus()
}
'Programming > Kotlin' 카테고리의 다른 글
SharedPreference 사용하는 방법. (0) | 2020.04.23 |
---|