Friday, December 11, 2009

SubString String Function 01

JavaScript Substring function returns the part of the provided string starting from the specified index. By default JavaScript substring function returns the substring starting from the specified index to the end of provided string. Lets try the following sample code to understand the functionality:
<html>
<head>
    <title>Javascript Substring String Function 01</title>
</head>
<body>

<script type="text/javascript">

var myString = new String();
myString = "JavaScript SubString";

document.write(myString.substring(11));

</script>

</body>
</html>
JavaScript Substr function returns the part of the provided string starting from the specified starting index. By default JavaScript substr function returns the sub string starting from the specified starting index to the end of provided string. Lets try the following sample code to understand the functionality:
<html>
<head>
    <title>Javascript Substr String Function 01</title>
</head>
<body>

<script type="text/javascript">

var myString = new String();
myString = "JavaScript Substr Sample";

document.write(myString.substr(11));

</script>

</body>
</html>
--
ఇట్లు మీ,
చంద్రశేఖర్.

No comments: