Linked Questions

23 votes
1 answer
17k views

For JAVA development I need writing to a files with strings like "\r\t\n <>", because from Java I want writing a PHP file. If you can't understand look at this example: BufferedWriter buffW = new ...
Marin Sagovac's user avatar
10 votes
2 answers
14k views

I need to work with long strings containing line breaks in Java. Those are for HTML generation, but it is not the most important here. I'm aware Java is cripple in a way it doesn't have heredocs. But ...
FolksLord's user avatar
  • 1,010
-1 votes
1 answer
8k views

I have done C++ in the past and to continue with a long line of code I would use the: \ operator. My compiler does not seem to recognize that in Java (obviously). What command do I use for next line ...
donkeyKong's user avatar
-2 votes
1 answer
4k views

I know scala use stripMargin to create multiline,such as: def catalog = s"""{ |"table":{"namespace":"default", "name":"table1"},...
Pookly's user avatar
  • 153
0 votes
1 answer
833 views

I have a block of json that I want to initialize a string with and I want to keep the formatting but this doesn't work. The json will be much larger than this but just looking for possibilities for ...
genxgeek's user avatar
  • 13.4k
-1 votes
1 answer
144 views

I'm using multiple + in the code. I want to know if there is any other way to do so without using + many times. package java; import java.util.Scanner; public class Calculator { public static void ...
Piyush Pandita's user avatar
7 votes
0 answers
72 views

In C#, you can use verbatim string literals so that you don't have to include '+' sign to concatenate strings on multiple lines. For example: var fooStr = @"This is a foo string. It ...
chaudharyp's user avatar
  • 3,624
-1 votes
1 answer
33 views

int i=st.executeUpdate("update tbl_loginprogrammer1 JOIN tbl_loginprogrammer ON tbl_loginprogrammer1.pid = tbl_loginprogrammer.proid SET tbl_loginprogrammer1....
joe's user avatar
  • 1
746 votes
23 answers
632k views

JavaScript has Array.join() js>["Bill","Bob","Steve"].join(" and ") Bill and Bob and Steve Does Java have anything like this? I know I can cobble something ...
Jason S's user avatar
  • 190k
223 votes
6 answers
116k views

Unfortunately, Java has no syntax for multi-line string literals. No problem if the IDE makes it easy to work with constructs like String x = "CREATE TABLE TEST ( \n" + "A INTEGER NOT ...
Thilo's user avatar
  • 264k
70 votes
9 answers
148k views

When should we use + for concatenation of strings, when is StringBuilder preferred and When is it suitable to use concat. I've heard StringBuilder is preferable for concatenation within loops. Why is ...
Manish Mulani's user avatar
48 votes
3 answers
42k views

With JDK/12 EarlyAccess Build 10, the JEP-325 Switch Expressions has been integrated as a preview feature in the JDK. A sample code for the expressions (as in the JEP as well): Scanner scanner = new ...
Naman's user avatar
  • 32.6k
36 votes
4 answers
31k views

How is it possible in Eclipse JDT to convert a multiline selection to String. Like the following From: xxxx yyyy zzz To: "xxxx " + "yyyy " + "zzz" I tried the following template "${line_selection}...
user avatar
29 votes
2 answers
42k views

I am developing Java using intellij idea. And I want to assign a json like format to a Java String. But I am tired with escape characters that I have to deal with. Is there any easy tool to format ...
User4506837's user avatar
24 votes
6 answers
6k views

In python I can construct a HTML string without worrying about escaping special characters like < or " by simply enclosing the string in triple quotes like: html_string = """ <html> <body&...
das_weezul's user avatar
  • 6,122

15 30 50 per page