snippetrustMajor
How do I write a multi-line string in Rust?
Viewed 0 times
howlinewriterustmultistring
Problem
Is it possible to write something like:
fn main() {
let my_string: &str = "Testing for new lines \
might work like this?";
}Solution
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.Context
Stack Overflow Q#15265198, score: 53
Revisions (0)
No revisions yet.