Core JavaScript

Intermediate JavaScript

JavaScript Reference

JavaScript String Functions




In Javascript following string function is use for different operatrion. If you want to cout the string length use str.length function etc. Also String is transfer to Uppercase or Lowercase and change the style of string and more string functions.


Count the length of a string

Exaple-Code:

<script type="text/javascript">
var str = "Hello String!";
document.write(str.length); 
</script>

Example-Result:


String toLowerCase() and toUpperCase()

Exaple-Code:

<script type="text/javascript">
var str = "Hello String";
document.write(str.toUpperCase() + "<br />");
document.write(str.toLowerCase()); 
</script>

Example-Result:


String Different Style

Exaple-Code:

<script type="text/javascript">
var str = "Hello String";
document.write("<p> Bold: " + str.bold() + "</p>");
document.write("<p> Italic: " + str.italics() + "</p>");
document.write("<p> Big: " + str.big() + "</p>");
document.write("<p> Small: " + str.small() + "</p>");
document.write("<p> Strike: " + str.strike() + "</p>");
document.write("<p> Fontsize: " + str.fontsize(4) + "</p>");
document.write("<p> Fontcolor: " + str.fontcolor("orange") + "</p>");
document.write("<p> Link:"+str.link("http://Way2Tutorial.com")+"</p>");
document.write("<p> Subscript: " + str.sub() + "</p>");
document.write("<p> Superscript: " + str.sup() + "</p>")
</script>

Example-Result: