Signed-off-by: Graham <gpe@openrs2.org>
@ -19,6 +19,14 @@ public fun CharSequence.krHashCode(): Int {
return hash
}
public fun CharSequence.jagHashCode(): Int {
var hash = 0
for (c in this) {
hash = (hash * 61) + (c.code - 32)
public fun String.capitalize(): String {
return replaceFirstChar { it.titlecase() }
@ -21,6 +21,12 @@ class StringUtilsTest {
assertEquals(92340183, "h€llo".krHashCode())
@Test
fun testJagHashCode() {
assertEquals(0, "".jagHashCode())
assertEquals(1012849752, "hello".jagHashCode())
fun testCapitalize() {
assertEquals("Hello", "hello".capitalize())