JavaScript String Methods in Geogebra

Author:
JP MathPR
//JavaScript String Methods //charAt() var str = "Geogebra Web"; alert(str.charAt(0)); /////////////////////////////// //charCodeAt() var str = "Geogebra Web"; alert(str.charCodeAt(0)); /////////////////////////////// //concat() var str1 = "Geogebra "; var str2 = "Web"; alert(str1.concat(str2)); /////////////////////////////// //fromCharCode() alert(String.fromCharCode(65)); /////////////////////////////// //indexOf() var str = "Geogebra, welcome to the dynamic mathematics software."; alert(str.indexOf("welcome")); /////////////////////////////// //lastIndexOf() var str = "GeoGebra to learn mathematics and science. Dynamic mathematics for everyone!"; alert(str.lastIndexOf("mathematics")); /////////////////////////////// //match() var str = "The rain in SPAIN stays mainly in the plain"; var res = str.match(/ain/g); alert(res.join()); var str= "Welcome to geeks for geeks!"; var res=str.match(/eek/g); alert(res.join()); /////////////////////////////// //replace() var str = "Visit Help Geogebra!"; var res = str.replace("Help", "to"); alert(res); /////////////////////////////// //search() var str = "Visit Help Geogebra!"; var n = str.search("Geogebra"); alert(n); /////////////////////////////// //slice() var str = "Geogebra Web!"; var res = str.slice(0, 3); alert(res); /////////////////////////////// //split() var str = "How are you doing today?"; var res = str.split(""); alert(res.join()); /////////////////////////////// //substr() var str = "Geogebra Web"; var res = str.substr(3, 5); alert(res); /////////////////////////////// //substring() var str = "Geogebra Web"; var res = str.substring(3, 8); alert(res); /////////////////////////////// //toLowerCase() var str = "Geogebra Web"; var res = str.toLowerCase(); alert(res); /////////////////////////////// //toUpperCase() var str = "Geogebra Web"; var res = str.toUpperCase(); alert(res); /////////////////////////////// //valueOf() var str = "Geogebra Web"; var res = str.valueOf(); alert(res); ///////////////////////////////