Haha, there was already one in StringUtil. I was sure I'd checked...
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4881 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -83,19 +83,6 @@ public class Util
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Compute a hash code for a string. This is pretty expensive, so only compute
|
|
||||||
* it once if that's at all an option. This is the JDK algorithm...
|
|
||||||
*/
|
|
||||||
public static function hashCode (str :String) :int
|
|
||||||
{
|
|
||||||
var h :int = 0;
|
|
||||||
for (var i :int = str.length-1; i >= 0; i--) {
|
|
||||||
h = int(int(31*h) + str.charCodeAt(i));
|
|
||||||
}
|
|
||||||
return h;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you call a varargs method by passing it an array, the array
|
* If you call a varargs method by passing it an array, the array
|
||||||
* will end up being arg 1.
|
* will end up being arg 1.
|
||||||
|
|||||||
Reference in New Issue
Block a user