in smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/lang/KotlinTypes.kt [90:99]
fun isValidKotlinIdentifier(s: String): Boolean {
s.forEachIndexed { idx, chr ->
val isLetterOrUnderscore = chr.isLetter() || chr == '_'
when (idx) {
0 -> if (!isLetterOrUnderscore) return false
else -> if (!isLetterOrUnderscore && !chr.isDigit()) return false
}
}
return true
}