N
N
Narryel2019-04-19 09:47:15
Java
Narryel, 2019-04-19 09:47:15

How to conveniently include a variable in a string in Intellij Idea?

Hello.
Can you please tell me if there is any hotkey or plugin in intellij idea to quickly include a variable in a string?
For example, there is a line "Everything is fine, variable value =", and you have
to write in this line "Everything is fine, variable value = " +variable +". "
PS: I know about soutv, but in most cases it is not suitable, especially when necessary add a variable to an already existing string

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Narryel, 2019-04-19
@narryel

Added Live Template:
Abbreviation: ++
Description: Insert variable into string
Expand with: Enter
Template text: "+ $EXPR$ +" (quotes too)
Edit Template Variable:
expression:variableOfType("") default Value: "expr"
Screenshot :
It works like this: you write ++ in a line, press Enter (you can change the hotkey in the settings), and select a variable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question