From 0468971b404cee5582d360d7d1c66bb4148e1614 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Wed, 16 Mar 2022 21:41:40 +0100 Subject: Bugfix: carc and cbox cmp functions had bug. Renamed: i_key_sptr / i_val_sptr to i_key_arcbox / i_val_arcbox. Other smaller updates. --- examples/utf8replace_rs.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/utf8replace_rs.rs (limited to 'examples/utf8replace_rs.rs') diff --git a/examples/utf8replace_rs.rs b/examples/utf8replace_rs.rs new file mode 100644 index 00000000..717978aa --- /dev/null +++ b/examples/utf8replace_rs.rs @@ -0,0 +1,19 @@ + +pub fn main() { + let mut hello = String::from("hell😀 world"); + println!("{}", hello); + + hello.replace_range( + hello + .char_indices() + .nth(4) + .map(|(pos, ch)| (pos..pos + ch.len_utf8())) + .unwrap(), + "🐨", + ); + println!("{}", hello); + + for c in hello.chars() { + print!("{},", c); + } +} -- cgit v1.2.3