Use Char extensions instead of java.lang.Character

Proprietary

Replaces JVM-only static helpers on java.lang.Character (isDigit(c), isLetter(c), toUpperCase(c), digit(c, radix), compare(a, b), toString(c), surrogate predicates) with the multiplatform Kotlin extensions on Char (c.isDigit(), c.uppercaseChar(), c.digitToInt(radix), …).

org.openrewrite.kotlin.migrate.UseKotlinChar$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.migrate.UseKotlinChar$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Use Char.isDigit() instead of Character.isDigit(c)
  2. Use Char.isLetter() instead of Character.isLetter(c)
  3. Use Char.isLetterOrDigit() instead of Character.isLetterOrDigit(c)
  4. Use Char.isWhitespace() instead of Character.isWhitespace(c)
  5. Use Char.isUpperCase() instead of Character.isUpperCase(c)
  6. Use Char.isLowerCase() instead of Character.isLowerCase(c)
  7. Use Char.isDefined() instead of Character.isDefined(c)
  8. Use Char.isISOControl() instead of Character.isISOControl(c)
  9. Use Char.isHighSurrogate() instead of Character.isHighSurrogate(c)
  10. Use Char.isLowSurrogate() instead of Character.isLowSurrogate(c)
  11. Use Char.isTitleCase() instead of Character.isTitleCase(c)
  12. Use Char.uppercaseChar() instead of Character.toUpperCase(c)
  13. Use Char.lowercaseChar() instead of Character.toLowerCase(c)
  14. Use Char.digitToInt(radix) instead of Character.digit(c, radix)
  15. Use Int.digitToChar(radix) instead of Character.forDigit(digit, radix)
  16. Use Char.compareTo instead of java.lang.Character.compare
  17. Use Char.toString() instead of Character.toString(c)