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