Home »
Code Examples »
Scala Code Examples
Scala - Script to convert strings to uppercase using object Code Example
The code for Script to convert strings to uppercase using object
object ConvertUpper {
def upperfun(strings: String*) = strings.map(_.toUpperCase())
}
println(ConvertUpper.upperfun("Hello", "Hello, world!", "How are you?", "Bye!"))
/*
Output:
ArraySeq(HELLO, HELLO, WORLD!, HOW ARE YOU?, BYE!)
*/
Code by IncludeHelp,
on August 7, 2022 17:22