summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/utf8replace_rs.rs
diff options
context:
space:
mode:
authortylov <[email protected]>2023-07-20 15:09:10 +0200
committertylov <[email protected]>2023-07-20 15:12:29 +0200
commit900295256d825fc323149cd223c49787f32a3696 (patch)
tree6c79cf4209e3975bb6865e2940b9cb56ea469c73 /misc/examples/utf8replace_rs.rs
parent224a04f7fa7549ed94d2a1415eb25829e39a7cca (diff)
downloadSTC-modified-900295256d825fc323149cd223c49787f32a3696.tar.gz
STC-modified-900295256d825fc323149cd223c49787f32a3696.zip
Moved examples to sub-directories. Added cotask1.c cotask2.c examples.
Diffstat (limited to 'misc/examples/utf8replace_rs.rs')
-rw-r--r--misc/examples/utf8replace_rs.rs22
1 files changed, 0 insertions, 22 deletions
diff --git a/misc/examples/utf8replace_rs.rs b/misc/examples/utf8replace_rs.rs
deleted file mode 100644
index 8b163b4e..00000000
--- a/misc/examples/utf8replace_rs.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-pub fn main() {
- let mut hello = String::from("hell😀 w😀rld");
- println!("{}", hello);
-
- /* replace second smiley at utf8 codepoint pos 7 */
- hello.replace_range(
- hello
- .char_indices()
- .nth(7)
- .map(|(pos, ch)| (pos..pos + ch.len_utf8()))
- .unwrap(),
- "🐨",
- );
- println!("{}", hello);
-
- for c in hello.chars() {
- print!("{},", c);
- }
-
- let str = "If you find the time, you will find the winner";
- println!("\n{}", str.replace("find", "match"));
-}