Formatting strings

Reading through the Rust-book (https://doc.rust-lang.org/book/ch08-02-strings.html) to try to learn Rust, I saw this:

let s = format!("{}-{}-{}", s1, s2, s3);

but a syntax that I really liked in C# is this (because it is shorter):

var s = $"{s1}-{s2}-{s3}";

Is there something similar in Rust where you add the variable where they should be, instead of in comma separated list after the format string? Is it something that is planned to be added to the language?

https://crates.io/crates/ifmt

Generally, If can be done with macro, there is no need to add it to the language.

5 Likes

Wow, cool, this language (and all crates available) starts to impress me more and more.

Thanks @Fiedzia...