How do I write a multi-line string in Rust?

后端 未结 5 1024
长情又很酷
长情又很酷 2021-02-02 06:06

Is it possible to write something like:

fn main() {
    let my_string: &str = \"Testing for new lines \\
                           might work like this?\";
         


        
5条回答
  •  臣服心动
    2021-02-02 06:24

    If I'm reading the language reference correctly, then it looks like that should work. The language ref states that \n etc. are supported (as common escapes, for inserting line breaks into your string), along with "additional escapes" including LF, CR, and HT.

提交回复
热议问题