convert multi line string to single line in scala -
val mystring =""" |a=b |c=d |""".stripmargin
i want convert single line deliminater ;
a=b;c=d;
tried mystring.replaceall("\r",";")
, mystring.replaceall("\n",";")
didn't work
i tried \n
, works
scala> val mystring = """ | a=b | c=d | """.stripmargin mystring: string = " a=b c=d " scala> mystring.replaceall("\n",";") res0: string = ;a=b;c=d; scala> res0.substring(1, mystring.length) res1: string = a=b;c=d;
i hope helps
Comments
Post a Comment