Share on Google+Share on Google+

JavaScript String Function

Advertisement
JavaScript String: Almost every language provides special attention towards string and string manipulation, JavaScript is no exception. It provides many built-in functions to manipulate a string. This tutorial provides many built-in functions which will help you to learn string in detail.

JavaScript String Function

Almost every language provides special attention towards string and string manipulation, JavaScript is no exception. It provides many built-in functions to manipulate a string. 

Java String Function Example:

<html>
<head>
<script type="text/javascript">
document.write("<b/>Length of the String is:</b><br/>" );
str="This is a string";
document.write(str.length);
document.write("<br/><b/>Lowercase of the string is:</b><br/>" );
str="THIS IS IN LOWERCASE";
document.write(str.toLowerCase(str));
document.write("<br/><b/>Uppercase of the string is:</b><br/>" );
str="this is in uppercase";
document.write(str.toUpperCase(str));
str1="Wel";
str2="Come";
document.write("<br/><b>After concatanation the string is:</b><br/>"+str1.concat(str2));
</script>
</head>
</html>

Output:

Length of the String is:
16
Lowercase of the string is:
this is in lowercase
Uppercase of the string is:
THIS IS IN UPPERCASE
After concatanation the string is:
WelCome

Advertisements

Advertisement

Posted on: November 7, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.