- To convert string into UPPERCASE
User Input: hello World
Output: HELLO WORLD
import java.util.Scanner
fun main(args: Array) {
val s1:String
val userInput = Scanner(System.`in`)
print("Enter your string : ")
s1 = userInput.nextLine()
println("Your UPPERCASE String : ${s1.toUpperCase()}")
}
Enter your string : Have good day Your UPPERCASE string : HAVE GOOD DAYProgram
You should know first :
Lowercase alphabets : Starts from a (97) to z (122)
Uppercase alphabets : Starts from A (65) to z (90)
You can use predefined function toUpperCase()
s1.toUpperCase()
s1.toLowerCase()
Concept