From da0e7128a8b5a9688aec12be8a4221c17e40d1d3 Mon Sep 17 00:00:00 2001 From: Unbewohnte Date: Fri, 18 Jun 2021 14:32:32 +0300 Subject: [PATCH] New utility --- string_to_Unicode_codepoint/Cargo.toml | 10 ++++++++++ string_to_Unicode_codepoint/README.md | 24 ++++++++++++++++++++++++ string_to_Unicode_codepoint/UNLICENSE | 24 ++++++++++++++++++++++++ string_to_Unicode_codepoint/src/main.rs | 10 ++++++++++ 4 files changed, 68 insertions(+) create mode 100644 string_to_Unicode_codepoint/Cargo.toml create mode 100644 string_to_Unicode_codepoint/README.md create mode 100644 string_to_Unicode_codepoint/UNLICENSE create mode 100644 string_to_Unicode_codepoint/src/main.rs diff --git a/string_to_Unicode_codepoint/Cargo.toml b/string_to_Unicode_codepoint/Cargo.toml new file mode 100644 index 0000000..5f6dde7 --- /dev/null +++ b/string_to_Unicode_codepoint/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "string_to_Unicode_codepoint" +version = "0.1.0" +authors = ["Unbewohnte "] +edition = "2018" +license = "Unlicense" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/string_to_Unicode_codepoint/README.md b/string_to_Unicode_codepoint/README.md new file mode 100644 index 0000000..a67eff4 --- /dev/null +++ b/string_to_Unicode_codepoint/README.md @@ -0,0 +1,24 @@ +# string_to_Unicode_codepoint +## Get Unicode codepoints of provided string`s chars + +--- + +# Compilation (you`ll need [Rust](https://www.rust-lang.org/tools/install) installed) +- `cd` into the project folder +- `cargo build --release` + +Compiled binary file will be in `./target/release/` directory + +--- + +# Usage +`./string_to_Unicode_codepoint SOME_TEXT_OR_ᗜˬᗜ_ȿन頿⍅獅_FANCY_CHARS_HERE` +`./string_to_Unicode_codepoint "SAME AS BEFORE, BUT NOW YOU CAN ADD SPACES !"` + +## Examples + +- `./string_to_Unicode_codepoint "ᗜˬᗜ is actually 15DC 02EC 15DC !"` +- `./string_to_Unicode_codepoint "You can print it by pressing ctrl+shift+u+CODEPOINT_HERE"` +- `./string_to_Unicode_codepoint "ɖ࠴ɴܣͲঙȴ" > outputFile.txt` - to save the output in a file (on Unix OSs) + +--- diff --git a/string_to_Unicode_codepoint/UNLICENSE b/string_to_Unicode_codepoint/UNLICENSE new file mode 100644 index 0000000..68a49da --- /dev/null +++ b/string_to_Unicode_codepoint/UNLICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/string_to_Unicode_codepoint/src/main.rs b/string_to_Unicode_codepoint/src/main.rs new file mode 100644 index 0000000..087a397 --- /dev/null +++ b/string_to_Unicode_codepoint/src/main.rs @@ -0,0 +1,10 @@ +fn main() { + let args: Vec = std::env::args().collect(); + let given_string: String = String::from(args[1].clone()); + + let mut counter:u128 = 0; + for character in given_string.chars() { + println!("{}: {} \t<---->\t {:x}", counter, character, character as u32); + counter += 1; + } +}