Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Filter by
Sorted by
Tagged with
0 votes
1 answer
190 views

There are two things I'd like to figure out: If I am typing a String literal and hit enter, it should be converted to a text block. The same way you can highlight a block of text and hit CTRL+SHIFT+C ...
Roberto Murphy's user avatar
1 vote
0 answers
230 views

I am having a problem with spotless, when applied to a file with a text block. I am using the following configuration for spotless in pom.xml. However, using eclipse java formatter has similar (but ...
Joseph K. Strauss's user avatar
-2 votes
2 answers
7k views

I am using multi line strings in java 17.0.2 but have been recieving the following error String test = """ { "deploymentResourceId": "...
pirateking's user avatar
-5 votes
2 answers
1k views

Let's say we have the following java text block : String textblock = """ A : 111 B : 111 C : 1111 "&...
Hassen Gaaya's user avatar
7 votes
1 answer
10k views

I need to keep JSON data in my code for unit-tests as string. For instance, { "one": 1, "two": 2 } I know that I can read this data from file or from property, but I need ...
Maxim Suslov's user avatar
  • 5,775
3 votes
1 answer
360 views

I am developing a text-based game and I want to make the title something catchy. I tried to use a text to ASCII converter to make a nice-looking title and then copy and paste it in my code to output ...
Godatgaming065's user avatar
0 votes
1 answer
1k views

In Java, now that it supports text blocks, you can do this: @Schema(description = """ Line one. Line two. """) public void ...
k314159's user avatar
  • 12.5k
8 votes
1 answer
3k views

Given the following code public class TextBlock { public static void main(String[] args) { String indentedText = """ hello indented ...
Wojciech Wirzbicki's user avatar
3 votes
1 answer
3k views

I started using Java 15 text blocks which are nice for readability. Now I want to format text blocks and inject strings in them, and from what I understand the idiomatic way to do this right now is to ...
raja-s's user avatar
  • 139
4 votes
1 answer
2k views

In Java 15, JEP 378: Text Blocks added three instance methods to String: stripIndent(), translateEscapes(), and formatted(Object... args): The following methods will be added to support text blocks; ...
M. Justin's user avatar
  • 23.3k
8 votes
2 answers
3k views

Is it possibly to use Javas text blocks feature (Java 15) but only write a single line? It seems that I am forced to write multiple lines. For example, I want write this in one line to avoid escaping ...
SL5net's user avatar
  • 2,630
6 votes
1 answer
16k views

Java SE 13 introduced Text Blocks (or Multiline Strings) feature. What are its differences and the similarities with the existing string representation?
Arvind Kumar Avinash's user avatar
0 votes
1 answer
324 views

This is for a hangman game, and the logic works great- the word fills in correctly, and the hangman gets more and more hanged with each word. However, the "graphics" are a little difficult ...
Cole Henrich's user avatar
3 votes
2 answers
2k views

Java 15 brings us the new JEP 378: Text Blocks feature. This eases working with multi-line strings. Can IntelliJ be made to parse the text within that block as some kind of syntax? Is there a way for ...
Basil Bourque's user avatar
6 votes
1 answer
2k views

Java 15 introduced (non-preview) text blocks feature. It allows to define multi-lined string literals without breaking code indentation, by stripping the common white space prefix from the lines. The ...
Alex Shesterov's user avatar
1 vote
3 answers
2k views

I am in the process of learning how to cope with java 14 (preview) text blocks. When using following text block in a Junit test I run across the following unexpected feature (simplified code example, ...
PaulN's user avatar
  • 93
49 votes
3 answers
31k views

How can I put a variable into Java Text Block? Like this: """ { "someKey": "someValue", "date": "${LocalDate.now()}", } ""&...
Dennis Gloss's user avatar
  • 2,931
19 votes
1 answer
13k views

I have existing code such as this: String sql = "CREATE TABLE " + tableName + " (\n" + " id_ UUID DEFAULT random_uuid() PRIMARY KEY ,\n" + " when_ TIMESTAMP WITHOUT TIME ZONE NOT ...
Basil Bourque's user avatar
26 votes
7 answers
54k views

In Scala you can do something like this: val expr = """ This is a "string" with "quotes" in it! """ Is there something like this in Java? I abhor using "\"" to represent strings with quotes in them. ...
HiChews123's user avatar
  • 1,706