Java – Eclipse: externalizing strings?

It seems that the "externalize strings" function can get all the contents, generate a messages class, and a Txt file, used to store the string itself This is interesting, but I have another way to store constants:

public final class Constants {
    //for parsing commands
    public static final String REGEX_COMMAND = "(\\w*) *= *\"(.*)\""; //Regex for a command from a data file
    //etc
}

Is there a way for eclipse to automatically move strings and other values here?

Solution

Select a text, right-click, refactor – > extract constant... Continue with the wizard

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>