Search
Sponsors

Archive for the ‘Strings’ Category

Search for a string in another

Thursday, February 5th, 2009

This example will search for a specified string value within a string, this uses the match() method

<script type=”text/javascript”>

var str=”Programmers help!”;
//The first one will be a match
document.write(str.match(”Programmers”) + “<br />”);
//this one will not be a match, watch the case sensitivity
document.write(str.match(”programmers”) + “<br />”);
</script>

Translate