6

I constructed this live template:

public boolean is$var$Present() { return $varname$.isPresent(); } 

enter image description here

I expect the variable name I type to be converted to camelCase and inserted to "return ...." string, but this does not happen. the "return ..." part stays unchanged.

2 Answers 2

6

In Live Templates Page, you can click "Edit variables" to make connection between two or more variables.

In your case, you can set $varname$ as camelCase(var).

Screenshot:

IntelliJ IDEA live template with function - sample (camelCase)

Result:

result

Sign up to request clarification or add additional context in comments.

2 Comments

I made same mistake as probably @Alex did - I expected camelCase (not sure why) to change abc to Abc. List of functions is available here.
It's a good idea to check "Skip if defined", it behave as expected, you are not requested to fill it in. With arrows one can change the order as well. It is a good idea to fill also "var" as default value, so you know what you are filling in.
3

I found a solution:

public boolean is$capitalizedVar$Present() { return $var$.isPresent(); } 

enter image description here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.