Added startsWith().

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4301 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-08-07 19:46:47 +00:00
parent e4d7da7d19
commit 309000f827
+9
View File
@@ -34,6 +34,15 @@ public class StringUtil
return (startDex >= 0) && (str.indexOf(substr, startDex) >= 0);
}
/**
* Does the specified string start with the specified substring.
*/
public static function startsWith (str :String, substr :String) :Boolean
{
// just check once if it's at the beginning
return (str.lastIndexOf(substr, 0) == 0);
}
/**
* Utility function that strips whitespace from the ends of a String.
*/