Added endsWith().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4226 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user