diff options
author | garhve <git@garhve.com> | 2022-12-30 13:47:02 +0800 |
---|---|---|
committer | garhve <git@garhve.com> | 2022-12-30 13:47:02 +0800 |
commit | 7fdb9249afe07c75ad8bea568195a3a8d979d73a (patch) | |
tree | 7360a15557b767071917204a1868b5672372dcb5 /rust/theBook/chapter-8-common-collections/string/src | |
parent | 8a8302fa5d94425c01b358de57c071d32af6b7ed (diff) |
finish chapter 8
Diffstat (limited to 'rust/theBook/chapter-8-common-collections/string/src')
-rw-r--r-- | rust/theBook/chapter-8-common-collections/string/src/main.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/rust/theBook/chapter-8-common-collections/string/src/main.rs b/rust/theBook/chapter-8-common-collections/string/src/main.rs new file mode 100644 index 0000000..c28e5b1 --- /dev/null +++ b/rust/theBook/chapter-8-common-collections/string/src/main.rs @@ -0,0 +1,18 @@ +fn main() { + let mut m = String::from("Hello"); + println!("{}",m); + + m.push_str(" World"); + println!("{}",m); + + let p = ", World"; + let l = m + &p; + println!("{}",l); + + let z = "tic"; + let x = "tac"; + let c = "toe"; + + let s = format!("{z}-{x}{c}"); + println!("{s}"); +} |