Replace deprecated capitalize and decapitalize

Proprietary

Replace String.capitalize() with String.replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() } and String.decapitalize() with String.replaceFirstChar { it.lowercase() }. These were deprecated in Kotlin 1.5 and become errors in Kotlin 2.1.

org.openrewrite.kotlin.migrate.ReplaceDeprecatedCapitalizeAndDecapitalize
mod run . --recipe=org.openrewrite.kotlin.migrate.ReplaceDeprecatedCapitalizeAndDecapitalize

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. Replace Kotlin method
  2. Replace Kotlin method