pub fn truncate(text: &str, max_len: usize) -> StringExpand description
Truncates text to a maximum length with default ellipsis suffix “…”.
Uses character count (not byte count) to safely handle multi-byte UTF-8.
§Examples
use aptu_core::utils::truncate;
// Short text unchanged
assert_eq!(truncate("Hello", 10), "Hello");
// Long text truncated with ellipsis
let long = "This is a very long title that exceeds the limit";
let result = truncate(long, 20);
assert!(result.ends_with("..."));
assert!(result.chars().count() <= 20);