diff --git a/src/generator/ical.rs b/src/generator/ical.rs index 0c5288e..68fefde 100644 --- a/src/generator/ical.rs +++ b/src/generator/ical.rs @@ -19,13 +19,13 @@ fn get_value(value: &Option) -> String { } pub(crate) fn split_line>(str: T) -> String { - let mut str = str.into(); - let mut x = 75; - while x < str.len() { - str.insert_str(x, "\r\n "); - x += 77; - } - str + let str = str.into(); + let mut chars = str.chars(); + let sub_string = (0..) + .map(|_| chars.by_ref().take(75).collect::()) + .take_while(|s| !s.is_empty()) + .collect::>(); + sub_string.join("\r\n ") } //