자바스크립트 문자열 자르기
<SCRIPT LANGUAGE="JavaScript">
str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
document.write("str returns: " + str + "<BR>");
document.write("str.substring(0, str.length) returns: ");
document.write(str.substring(0, str.length) + "<BR>");
document.write("str.substring(0, 1) returns: ");
document.write(str.substring(0, 1) + "<BR>");
document.write("str.substring(0, 5) returns: ");
document.write(str.substring(0, 5) + "<BR>");
document.write("str.substring(-5, 5) returns: ");
document.write(str.substring(-5, 5) + "<BR>");
document.write("str.substring(8, 13) returns: ");
document.write(str.substring(8, 13) + "<BR>");
document.write("str.substring(8, 99) returns: ");
document.write(str.substring(8, 99) + "<BR>");
document.write("str.substring(9, 9) returns: ");
document.write(str.substring(9, 9) + "<BR>");
document.write("str.substring(9, 8) returns: ");
document.write(str.substring(9, 8) + "<BR>");
document.write("str.substring(9, 0) returns: ");
document.write(str.substring(9, 0) + "<BR>");
document.write("str.length returns: ");
document.write(str.length + "<BR>");
document.write("str.substring( str.length-3, str.length) returns: ");
document.write(str.substring( str.length-3, str.length) + "<BR>");
</SCRIPT>
================================================
str.substring(시작인덱스, 끝인덱스)
================================================
출처 : PHP스쿨
str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
document.write("str returns: " + str + "<BR>");
document.write("str.substring(0, str.length) returns: ");
document.write(str.substring(0, str.length) + "<BR>");
document.write("str.substring(0, 1) returns: ");
document.write(str.substring(0, 1) + "<BR>");
document.write("str.substring(0, 5) returns: ");
document.write(str.substring(0, 5) + "<BR>");
document.write("str.substring(-5, 5) returns: ");
document.write(str.substring(-5, 5) + "<BR>");
document.write("str.substring(8, 13) returns: ");
document.write(str.substring(8, 13) + "<BR>");
document.write("str.substring(8, 99) returns: ");
document.write(str.substring(8, 99) + "<BR>");
document.write("str.substring(9, 9) returns: ");
document.write(str.substring(9, 9) + "<BR>");
document.write("str.substring(9, 8) returns: ");
document.write(str.substring(9, 8) + "<BR>");
document.write("str.substring(9, 0) returns: ");
document.write(str.substring(9, 0) + "<BR>");
document.write("str.length returns: ");
document.write(str.length + "<BR>");
document.write("str.substring( str.length-3, str.length) returns: ");
document.write(str.substring( str.length-3, str.length) + "<BR>");
</SCRIPT>
================================================
str.substring(시작인덱스, 끝인덱스)
================================================
출처 : PHP스쿨
http://www.joon.pe.kr/blog/trackback/270
