diff --git a/src/as/com/threerings/util/StringUtil.as b/src/as/com/threerings/util/StringUtil.as index 3ae3f1597..42d8dd5c2 100644 --- a/src/as/com/threerings/util/StringUtil.as +++ b/src/as/com/threerings/util/StringUtil.as @@ -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. */