Home »
Code Examples »
Scala Code Examples
Scala - Script to convert strings to uppercase using class Code Example
The code for Script to convert strings to uppercase using class
class ConvertUpper {
def upperfun(strings: String*): Seq[String] = {
strings.map((s:String) => s.toUpperCase())
}
}
val up = new ConvertUpper
Console.println(up.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:19