study

자스 문자열체크 및 대소문자구분

intseq 2013. 10. 27. 00:55

String.length

스트링의 길이를 알려준다.

 

예 1>

01 var x = "Netscape";
02 var empty = "";
03 
04 console.log("Netspace is " + x.length + " code units long"); // 8
05 console.log("The empty string is has a length of " + empty.length); /* should be 0 */

 

String.toLowerCase, String.toUpperCase

불러들인 스트링 값을 소문자(대문자)로 변환 한다.

 

예 2>

01 var sampleText="AlPhaBet";
02 document.write(sampleText.toLowerCase() 
03         + " " + sampleText.toUpperCase());
04         // alphabet ALPHABET