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

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.