IDEA 換行符+號在行開頭

IDEA 換行符+號在行開頭

1.前言

當我們拷貝一段字符時,每當換行的時候爲了結構美觀便於查看信息我們希望換行符能夠在每行的開頭。只需要在IDEA中修改設置即可。

2.修改設置

在這裏插入圖片描述

2.1.對比修改前後效果
2.1.1.修改設置前
  • 換行符+號位置不固定結構混亂不方便查看字符串內容
public static void getString(String str) {

        String classStringFormat = "package com.bruce;\n" +
                "\n" +
                "/**\n" +
                " * @author bruce\n" +
                " */\n" +
                "public class Str extends AbstractStr{\n" +
                "\n" +
                "    protected Str() {\n" +
                "        super(\"user\", \"users\");\n" +
                "    }\n" +
                "}";
    }
2.1.2. 修改設置後
  • 換行符+號位置固定在每行開頭 結構整潔有序方便查看字符串內容
    public static void getString(String str) {

        String classStringFormat = "package com.bruce;\n"
                + "\n"
                + "/**\n"
                + " * @author bruce\n"
                + " */\n"
                + "public class Str extends AbstractStr{\n"
                + "\n"
                + "    protected Str() {\n"
                + "        super(\"user\", \"users\");\n"
                + "    }\n"
                + "}";
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章