pub fn chunk_string(str_input: &str, size: i32) -> Vec<String>Expand description
Splits a string into chunks of specified size.
This function takes a string and divides it into chunks of the specified size. The last chunk may be shorter than the specified size if the string length is not evenly divisible by the chunk size.
§Arguments
str_input- The input string to be chunkedsize- The size of each chunk
§Returns
Vec<String>- A vector containing the chunked strings
§Panics
Panics if the chunk size is less than or equal to 0
§Examples
use lowdash::chunk_string;
let result = chunk_string("hello", 2);
assert_eq!(result, vec!["he", "ll", "o"]);