How do you replace single quotes with double quotes in Scala? I have a data file that has some records with "abc" (double quotes). I need to replace these quotes with single quotes and convert it to a data frame.
val customSchema_1 =
StructType(Array(
StructField("ID", StringType, true),
StructField("KEY", StringType, true),
StructField("CODE", StringType, true))
val df_1 = sqlContext.read
.format("com.databricks.spark.csv")
.option("delimiter", "¦")
.schema(customSchema_1)
.load("example")
Read line by line your file and apply following example to each of them:
This will give you a new String value with quotes instead of double quotes.