2014-10-22 71 views
0

有没有办法使用IntelliJ-Idea按字母顺序来格式化(排列)变量字符串? 示例代码:如何使用jidea按字母顺序格式化变量字符串?

public static final String c = "some_value"; 
public static final String a = "some_value"; 
public static final String b = "some_value"; 

格式化应该出现如下之后,

public static final String a = "some_value"; 
public static final String b = "some_value"; 
public static final String c = "some_value"; 

请这方面的帮助。

回答

0

转到File - >Settings --->Code Style(选择其下Java)--->Arrangement --->Editpublic static final行--->选择Orderorder by name

然后转到Code --->Reformat Code --->Ticked the Reformat entries从弹出.-->Run

这就是它。

enter image description here

enter image description here

1

Settings > Project Settings > Code Style > Java > Arrangement ~ Matching Rules。在那里(每个规则)你可以选择order by name。这应该按照您的要求按字母顺序排列。虽然我不知道是否需要更改所有匹配规则。

相关问题