Scala - How to create a multi-line text using stripMargin? Code Example

The code for How to create a multi-line text using stripMargin?

val Info: String =
    """
      |{
      |"kingdome":"Ayodhya",
      |"king":"Shri Ramchandra",
      |"years_ruled":11000
      |}
      """
   .stripMargin

println("Creating multi-line text using stripMargin")   
println(Info)

/*
Creating multi-line text using stripMargin

{
"kingdome":"Ayodhya",
"king":"Shri Ramchandra",
"years_ruled":11000
}
*/
Code by IncludeHelp, on August 8, 2022 03:37

Comments and Discussions!

Load comments ↻






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