1-6ren">
gpt4 book ai didi

java - Eclipse,将if语句格式化为一行语句

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:38:33 25 4
gpt4 key购买 nike

有没有办法创建一个自动格式化程序来改变:

if (foo.length > 1)
bar = foo[1];
else
bar = "";

bar = (foo.length > 1) ? foo[1] : ""; 

如何让 shift+ctrl+f 自动组织这个?

最佳答案

此插件专门用于将 if-else block 更改为三元运算符。

https://marketplace.eclipse.org/content/spartan-refactoring-0

关于java - Eclipse,将if语句格式化为一行语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37392602/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com