Appending " to a string in Scala

0 votes

Hi,

I tried appending " to a string variable. Could you help me out how to get the Result as "Hello

--> var AppendSpecialCharacters = ""\Hello"

<console>:1: error: unclosed string literal

       var AppendSpecialCharacters = ""\Hello"

                                              ^
Jul 23 in Apache Spark by Firoz
25 views

1 answer to this question.

0 votes

1) Use the concat() function. Refer to the below screenshot for this,

image

2) You can add the two strings with the symbol. Refer to the below screenshot for this,

image

And if your concern was to just include a quote in a string then you can execute the command as shown in the below screenshot,

image

answered Jul 23 by Ritu

Related Questions In Apache Spark

0 votes
1 answer

Query regarding Appending " to a string in Scala

You can perform this task in two ...READ MORE

answered Jul 10 in Apache Spark by Esha
716 views
0 votes
1 answer

How to format a string in Scala?

Hey, To format a string, use the .format ...READ MORE

answered Jul 30 in Apache Spark by Gitika
• 25,340 points
29 views
0 votes
1 answer

Spark to check if a particular string exists in a file

You can use this: lines = sc.textFile(“hdfs://path/to/file/filename.txt”); def isFound(line): if ...READ MORE

answered Mar 15 in Apache Spark by Raj
283 views
0 votes
1 answer

How to execute a function in apache-scala?

Hi, Here is a simple example of how ...READ MORE

answered Jul 1 in Apache Spark by Gitika
• 25,340 points
45 views
0 votes
1 answer

Copy all files from local (Windows) to HDFS with Scala code

Please try the following Scala code: import org.apache.hadoop.conf.Configuration import ...READ MORE

answered May 22 in Apache Spark by Karan
376 views
0 votes
1 answer

Scala pass input data as arguments

Please refer to the below code as ...READ MORE

answered Jun 19 in Apache Spark by Lisa
43 views
0 votes
1 answer

Doubt in display(id, name, salary) before display function

The statement display(id, name, salary) is written before the display function ...READ MORE

answered Jun 19 in Apache Spark by Ritu
28 views
0 votes
1 answer

How to calculate the result of formula with Scala?

Hi, You can use a simple mathematical calculation ...READ MORE

answered Jul 1 in Apache Spark by Gitika
• 25,340 points
48 views
0 votes
1 answer

How to search for a Key in a Scala Map?

Hey, The Map.contains() method will tell you if ...READ MORE

answered Jul 29 in Apache Spark by Gitika
• 25,340 points
28 views
0 votes
1 answer

How to get ID of a map task in Spark?

you can access task information using TaskContext: import org.apache.spark.TaskContext sc.parallelize(Seq[Int](), ...READ MORE

answered Nov 20, 2018 in Apache Spark by Frankie
• 9,810 points
455 views