Friday, 28 August 2020

String Interpolation Example in Scala

String Interpolation Example in Scala: 

f, s, raw are the String Interpolation 

Embed variable references directly in processed string

object StringInterpolation {
def main(args:Array[String]){
  val name = "Sankaranarayanan"
  val height = 179.23423423
  println(s"Name : $name, Height : $height")
  println(f"Name : $name%s, Height : $height%f")
  println(s"Hello\t\t\tworld!")
  println(raw"Hello\t\t\tworld")  // Display the raw unformatted code
 }
}



Result:

Name : Sankaranarayanan, Height : 179.23423423
Name : Sankaranarayanan, Height : 179.234234
Hello world!
Hello\t\t\tworld

Flume - Simple Demo

// create a folder in hdfs : $ hdfs dfs -mkdir /user/flumeExa // Create a shell script which generates : Hadoop in real world <n>...