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

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -