pub fn rotate(s: &str, shift: i32) -> String
Expand description
Rotates the characters in a string by a given shift amount.
§Arguments
s
- A string slice to be rotated.shift
- An integer representing the number of positions to shift the characters.
§Returns
A String
with the characters rotated by the specified shift amount.
§Examples
use rust_string_utils::rotate;
let result = rotate("abcdefg", 2);
assert_eq!(result, "fgabcde");