String Method

por | 15 abril, 2007

 document.write(“<h1>String Methods</h1>”);

   var sample_string = “AaBbCcDdEeFfGg”;

   document.write(“<br>Orignal String: ” + sample_string);

   document.write(“<h2>Formatting</h2>”);

   document.write(“<br>toLowerCase: ” + sample_string.toLowerCase());

document.write(“<br>toUpperCase: ” + sample_string.toUpperCase());

document.write(“<br>bold: ” + sample_string.bold());

document.write(“<br>italics: ” + sample_string.italics());

document.write(“<br>strike: ” + sample_string.strike());

document.write(“<br>big: ” + sample_string.big());

document.write(“<br>small: ” + sample_string.small());

document.write(“<br>sup: ” + sample_string.sup());

document.write(“<br>sub: ” + sample_string.sub());

document.write(“<br>fixed: ” + sample_string.fixed());

document.write(“<br>fontcolor(red): ” + sample_string.fontcolor(“#FF0000”));

document.write(“<br>fontsize(-3):” + sample_string.fontsize(“-3”));

document.write(“<br>fixed: ” + sample_string.fontsize(“-3”));

 

   document.write(“<h2>Processing</h2>”);

 

document.write(“<br>substr(2, 2): ” + sample_string.substr(2, 2));

document.write(“<br>substring(2, 4): ” + sample_string.substring(2, 4));

document.write(“<br>concat(\”XxYxZz\”): ” + sample_string.concat(“XxYxZz”));

document.write(“<br>charAt(0): ” + sample_string.charAt(0));

document.write(“<br>charCodeAt(0): ” + sample_string.charCodeAt(0));

document.write(“<br>indexOf: ” + sample_string.indexOf(“A”));

document.write(“<br>search(\”Cc\”): ” + sample_string.search(“Cc”));

document.write(“<br>replace(\”Cc\”, \”Zz\”): ” + sample_string.replace(“Cc”, “Zz”));