rust_string_utils-0.1.11 has been yanked.
Rust String Utilities
Description
rust_string_utils
is a Rust library providing various utility functions for string manipulation.
Repository
Crates.io
https://crates.io/crates/rust_string_utils
Installation
Add the following to your Cargo.toml
:
[]
= "0.1.11"
Usage
Here are some examples of how to use the functions provided by this library:
Check if a string is empty
use is_empty;
let result = is_empty;
assert_eq!;
Check if a string is blank
use is_blank;
let result = is_blank;
assert_eq!;
Reverse a string
use reverse;
let result = reverse;
assert_eq!;
Check if a string starts with a prefix
use start_with;
let result = start_with;
assert_eq!;
Checks if the given string ends with the specified suffix.
use end_with;
let result = end_with;
assert_eq!;
Join characters with a delimiter
use join_char;
let result = join_char;
assert_eq!;
Replace a string in a string
let result = replace;
assert_eq!;
Replace a character in a string
let result = replace_char;
assert_eq!;
Count the number of occurrences of a character in a string
let count = count_matches;
assert_eq!;
Triple a string
let result = trip;
assert_eq!;
Swap case of a string
let result = swap_case;
assert_eq!;
Convert a timestamp to a human-readable date
let formatted_date = timestamp_to_string;
assert_eq!;
Convert a byte array to string
let bytes = vec!;
let result = bytes_to_string;
assert_eq!;
Rotate characters in a string
use rotate;
let result = rotate;
assert_eq!;
Split a string by whitespace
use split;
let result = split;
assert_eq!;
Split a string by specified separator characters
use split_with_separator;
let result = split_with_separator;
assert_eq!;
Compare two strings lexicographically
use compare;
let result = compare;
assert_eq!;
Compare two strings lexicographically, ignoring case differences
use compare_ignore_case;
let result = compare_ignore_case;
assert_eq!;
Compares two strings for equality.
use equals;
let result = equals;
assert_eq!;
Compares two strings for equality, ignoring case.
use equals_ignore_case;
let result = equals_ignore_case;
assert_eq!;
Finds the index of the first occurrence of the specified substring.
use index_of;
let index = index_of;
assert_eq!;
Finds the index of the first occurrence of the specified substring starting from a given index.
use index_of_from;
let index = index_of_from;
assert_eq!;
Finds the index of the last occurrence of the specified substring.
use last_index_of;
let index = last_index_of;
assert_eq!;
Overlays part of a string with another string
use overlay;
let result = overlay;
assert_eq!;
License
This project is licensed under either of
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)