【问题标题】:Is it possible to break `case xx : {` into two line with AStyle?是否可以用 AStyle 将 `case xx : {` 分成两行?
【发布时间】:2013-06-08 08:09:39
【问题描述】:

我需要格式化以下代码

switch(i) {
    case 1: {
            printf("a");
            break;
        }

进入:

switch(i) {
    case 1: 
        {
            printf("a");
            break;
        }

在其他情况下保持 k&r 括号样式。我怎么能这样做?

我试过--style=kr --indent-cases

【问题讨论】:

    标签: format astyle


    【解决方案1】:

    要替换的正则表达式:

    s/\(case.*:\s\+\){/\1\r{/g
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-30
      • 2010-11-26
      • 1970-01-01
      • 2020-10-03
      • 2011-05-09
      相关资源
      最近更新 更多