validate names in kotlin
问题 My problem is the user insert a name like "Jon Snow" and I don't know how to validate with a function if the names first char is upper case and if they are spare by a space fun checkName(nome:String):Boolean{ if (name[0].isUpperCase()){ var count=0 //if (nome) do { count++ }while (name[count]==' ') var charAfterSpace:Char=nome[count]+1 when(charAfterSpace.isUpperCase()){ false->return false //else->return true } } return false } 回答1: Split the string then check if all the elements match the