Extract variable from piece of string literal refactoring?

Is it possible to extract piece of string literal replacing it with
concatenation (either + or buffer/builder append based) with a
variable/method call or with introducing of a new local variable

"Good Night ToYou" ->

String greeting = "Night"; //introduced by refactoring
"Good " + greeting + " To You"

or

"Good " + getGreeting() + " To You"

getGreeting() is an existing function entered in a bow with auto completion


3 comments

This is possible with the excellent SmartIntroduce plugin.

Bas

0

But by god belongs in the core product.

--Dave Griffith

0

Alex Roytman wrote:

Is it possible to extract piece of string literal replacing it with
concatenation (either + or buffer/builder append based) with a
variable/method call or with introducing of a new local variable

"Good Night ToYou" ->

String greeting = "Night"; //introduced by refactoring
"Good " + greeting + " To You"

or

"Good " + getGreeting() + " To You"

getGreeting() is an existing function entered in a bow with auto completion

Depends how long the piece of string is... ;)

0

Please sign in to leave a comment.