Use take(n) instead of substring(0, n) on a String
Proprietarytake(n) is the named form on CharSequence and uniformly returns the empty string when n is larger than length. substring(0, n) throws on that case — the named form is both clearer and friendlier.
org. openrewrite. kotlin. stdlib. UseStringTakeForSubstringFromZero$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. stdlib. UseStringTakeForSubstringFromZero$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.