add contains() function to string library. added tests too.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@859 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -561,6 +561,16 @@ String.prototype.startsWith = function(sStart){
|
||||
return (this.substr(0,sStart.length) == sStart);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {String} str
|
||||
*
|
||||
* @returns Whether or not this string contains with the string passed in.
|
||||
* @type Boolean
|
||||
*/
|
||||
String.prototype.contains = function(str){
|
||||
return (this.indexOf(str) != -1);
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns A trimmed version of the string - all leading and
|
||||
* trailing spaces removed
|
||||
|
||||
Reference in New Issue
Block a user