Java Text Block

来自WHY42
Riguz留言 | 贡献2023年9月25日 (一) 05:13的版本 (Created page with "<syntaxhighlight lang="java"> public class Test { public static void main(String[] args) { String message = """ Hello world! This line is started with indention Reserved LE spaces \s """; System.out.println(message.replaceAll("\s", "~")); } } </syntaxhighlight> Output: <syntaxhighlight lang="java"> Hello~world! ~~~~This~line~is~started~with~indention Reserved~LE~spaces~~~...")
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
public class Test {
    public static void main(String[] args) {
        String message = """
                Hello world!
                    This line is started with indention     
                Reserved LE spaces    \s
                """;
        System.out.println(message.replaceAll("\s", "~"));
    }
}

Output:

Hello~world!
~~~~This~line~is~started~with~indention
Reserved~LE~spaces~~~~~