简体   繁体   中英

eclipse shorcut to extract string value to local variable

String test = var1 + "something";

what is the shortcut to extract "something" into variable? Searched in SO but found no question related to this.

Select the String including the double quotes and hit Alt + Shift + L

See Extract Local Variable at List of eclipse key bindings for reference

select the value with double quotes and then press ctrl+1

or go to

Refactor -> Extract local variable

Ctr+L,2

Assume you have done the following "".length() and want to store the result in an integer go anywhere on the instruction "".length() and press Ctrl+L a small window on the right bottom of the screen will open. Press L after that.

Please note it is not case sensitive.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM