Replace deprecated capitalize() function

Signed-off-by: Graham <gpe@openrs2.org>
Graham 4 years ago
parent b37e4d0d0b
commit 1954f408e7
  1. 1
      buffer-generator/build.gradle.kts
  2. 1
      buffer-generator/src/main/kotlin/org/openrs2/buffer/generator/IntType.kt
  3. 1
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/remap/FieldMappingGenerator.kt
  4. 4
      util/src/main/kotlin/org/openrs2/util/StringUtils.kt
  5. 7
      util/src/test/kotlin/org/openrs2/util/StringUtilsTest.kt

@ -11,6 +11,7 @@ application {
dependencies { dependencies {
api(libs.clikt) api(libs.clikt)
implementation(projects.util)
implementation(libs.kotlinPoet) implementation(libs.kotlinPoet)
implementation(libs.netty.buffer) implementation(libs.netty.buffer)
} }

@ -1,5 +1,6 @@
package org.openrs2.buffer.generator package org.openrs2.buffer.generator
import org.openrs2.util.capitalize
import kotlin.reflect.KClass import kotlin.reflect.KClass
public enum class IntType( public enum class IntType(

@ -5,6 +5,7 @@ import org.openrs2.asm.MemberRef
import org.openrs2.asm.classpath.ClassPath import org.openrs2.asm.classpath.ClassPath
import org.openrs2.asm.filter.MemberFilter import org.openrs2.asm.filter.MemberFilter
import org.openrs2.deob.util.map.NameMap import org.openrs2.deob.util.map.NameMap
import org.openrs2.util.capitalize
import org.openrs2.util.collect.DisjointSet import org.openrs2.util.collect.DisjointSet
import org.openrs2.util.indefiniteArticle import org.openrs2.util.indefiniteArticle

@ -18,3 +18,7 @@ public fun CharSequence.krHashCode(): Int {
} }
return hash return hash
} }
public fun String.capitalize(): String {
return replaceFirstChar { it.titlecase() }
}

@ -20,4 +20,11 @@ class StringUtilsTest {
assertEquals(99162322, "hello".krHashCode()) assertEquals(99162322, "hello".krHashCode())
assertEquals(92340183, "h€llo".krHashCode()) assertEquals(92340183, "h€llo".krHashCode())
} }
@Test
fun testCapitalize() {
assertEquals("Hello", "hello".capitalize())
assertEquals("Hello", "Hello".capitalize())
assertEquals("HELLO", "HELLO".capitalize())
}
} }

Loading…
Cancel
Save