JavaScript Replace String function allows you to replace the specified string pattern with new string pattern in the provided string. By Default JavaScript Replace function replaces only first occurrence of specified string pattern from the provided string text. Try the sample below to understand the functionality:
<html>
<head>
<title>Javascript Replace String Function 01</title>
</head>
<body>
<script type="text/javascript">
var myString = new String();
myString = "This is first example";
// by default it will find and replace the
// first occurrence of specified string pattern
document.write(myString.replace(/ /,"-"));
</script>
</body>
</html>
--
ఇట్లు మీ,
చంద్రశేఖర్.
Friday, December 11, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment