LDNDeveloper

Andrew Pallant

Software & Web Developer


Donate To Support My Blog Donate if this post helped you. Coffee money is always welcomed!




Javascript equalsIgnoreCase Function

Physical Link: Javascript equalsIgnoreCase Function


This week’s code sample is JAVASCRIPT based. I found this while researching user validation routines. This function is a javascript version of a common Java function. We have replicated the calling syntax as a java programmer would expect to use it by effectively appending it as a method of the javascript String Object.

For more great scripts: http://www.apriori-it.co.uk

Important Note: Works with IE and FireFox

//The first line assigns the MatchIgnoreCase function as 
//an equalsIgnoreCase method of the String object 

String.prototype.equalsIgnoreCase = MatchIgnoreCase; 

function MatchIgnoreCase(strTerm, strToSearch) 
{ 
	strToSearch = strToSearch.toLowerCase(); 
	strTerm = strTerm.toLowerCase(); 
	if(strToSearch==strTerm) 
	{ 
		return true; 
	} else { 
		return false; 
	} 
}

The post Javascript equalsIgnoreCase Function appeared first on Software Developer In London.

Author:
Categories: Better Coding, Deployment, Ideas, Web, Code, equalsIgnoreCase, Javascript, Tips


Google | humanstxt.org | Andrew Pallant's Blog Site
©2017 LdnDeveloper