전체 글
-
javascript) null과 undefined와 빈문자열"" 체크하기javascript 2023. 11. 30. 15:38
null과 undefined와 빈문자열"" 체크하기 null은 "의도적으로" 값이 할당되지않은 상태 undefined는 값이 아직 할당 되지않은상태 null, undefined를 체크하기) ㄴnull과 undefined과 빈문자열""는 모두 false로 간주된다 (false그 자체는 아니다!)(" "(공백은) true로 간주) 그래서 null == false; //false null === false; //false undefined == false; //false undefined ===false; //false 위는 모두 false 반환이 되지만(false 자체가 아니니까),null과 undefined앞에 !!를 붙이면 boolean값으로 변환되므로 !!null == false; // true !!n..
-
javascript) radio value 가져오기, 체크여부 확인카테고리 없음 2023. 11. 20. 17:18
-radio 체크된 값 가져오기 html) 직급: 팀원 팀장 javascript) var position = document.querySelector("input[name='position_value']:checked").value console.log(position) ㄴdocument.querySelector("input[name='position_value']:checked").value -radio 체크된 값 가져오기2, 체크여부 확인하기) html) 직급: 팀원 팀장 javascript) var radioTag = document.getElementsByName("position_value"); var position = null; for(var i=0;i
-
문자열에서 숫자만 남기기TIL 2023. 11. 13. 20:32
전화번호를 입력받을때 010 0000 0000 와 같이 입력받아야하는데, 010-0000-0000와 같이 입력받은 경우 생년월일,날짜를 20041010와 같이 입력받아야하는데, 2004/10/10, 2004-10-10등과 같이 입력받은 경우 입력받은 값에서 불필요한 문자들을 제거하여 원하는 형식으로 만들어야 한다. 입력받은 값들을 다음과 같이 변환해야하는 경우 010-0000-0000 -> 010 0000 0000 010.0000.0000 -> 010 0000 0000 2004-12-12 -> 2004 12 12 2004/12/12 -> 2004 12 12 str.replaceAll("[^0-9]","") // *숫자가 아닌 것들을 모두 제거
-
[TIL]이메일 형식 확인TIL 2023. 11. 13. 19:16
사용자로부터 입력받은 값이 이메일형식이 맞는지 확인하기 이메일 정규 표현식 ㄴ ^[A-z0-9]+@[A-z0-9]+\\.[a-z]{2,3}$ ^ : 문자열 시작 [A-z0-9]+ : 영문자,숫자가 1개이상 @ : @하나 존재해야함 [A-z0-9]+ : 영문자,숫자가 1개이상 \\. : .(점)하나 존재해야함. 혼자쓸수없어서 \(이스케이프) 같이씀 [a-z]{2,3} : a-z문자가 2~3개 $: 문자열 끝 java 코드) import java.util.regex.Pattern String pattern = "^[A-z0-9]+@[A-z0-9]+\\.[a-z]{2,3}$"; // 이메일 형식 정규표현식 String idValue = request.getParameter("id_value"); // 사용자에..
-
2차원 리스트 만들기카테고리 없음 2023. 11. 13. 15:37
-ArrayList 안에 ArrayList = 2차원리스트 ArrayList는 기본적으로 리스트 (배열과 차이) 코드) import java.util.*; or import java.util.ArrayList; ArrayList aList = new ArrayList(2); ArrayList a1 = new ArrayList(); a1.add(1); a1.add(2); aList.add(a1); ArrayList a2 = new ArrayList(); a2.add(3); a2.add(4); aList.add(a2); for(int i=0; i
-
정규표현식카테고리 없음 2023. 11. 13. 13:11
-기본적으로 대소문자 구분 ^ : 문자열의 시작,캐럿 $ : 문열의 끝,달러 \ : 정규표현식내 특정의미가 있는 단어를 일반문자로 변경, 이스케이프, 특정 역할로부터 벗어나게 해준다 . : (점), 모든 문자 []: 괄호 안에 문자중에하나, 대괄호전체가 문자하나 의미 []안에있는 - : a부터 b까지 -[]안에있는 ^ : 부정의미 | : or의미 {} : 중괄호안의 숫자만큼의미 ㄴ{3} : 3개 ㄴ{3,} : 3개이상 (?= ) : 해당문자를 기준으로 찾지만 그문자를 선택하지는 않음 예제) ^who ㄴ문장의 시작이 who 의미 ㄴwho is who ㄴ앞의 who를 탐색 who$ ㄴ문장의 끝이 who 의미 ㄴwho is who ㄴ뒤의 who를 탐색 ^\$ : $문자로 시작하는 문자열, 이스케이프 \$$ :..
-
CSS-transitioncss 2023. 9. 27. 15:21
css - transition a{ font-size : 3rem; display : inline-block; transition-property : all; transition-duration : 1s; = (transition : all 1s ease; ) } a:active{ transform: translate(20px,20px); font-size : 2rem; } ㄴ a:active{} 는 a태그가 클릭되었을때 적용할 속성, (hover는 마우스가 위에있을때, visited는 이미방문한 링크) ㄴ transfrom 속성은 block과 inline-block에만 적용된다. inline 속성에는 적용안됨 ㄴ 그래서 display에 inline-block 지정 ㄴ transition-property..