Added endsWith().

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4226 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-06-26 22:20:26 +00:00
parent a63af7933e
commit f27eb3f319
+9
View File
@@ -9,6 +9,15 @@ public class StringUtil
return (str == null) || (str.search("\\S") == -1);
}
/**
* Does the specified string end with the specified substring.
*/
public static function endsWith (str :String, substr :String) :Boolean
{
var startDex :int = str.length - substr.length;
return (startDex >= 0) && (str.indexOf(substr, startDex) > 0);
}
/**
* Utility function that strips whitespace from the ends of a String.
*/