From 744198e66eb2ce8f8c798b3c41dd4562b33c1e9e Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 23 Aug 2022 18:32:06 +0200 Subject: [PATCH] trim strings --- src/timetable.rs | 4 ++-- src/utils.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/timetable.rs b/src/timetable.rs index f291cd3..636bc10 100644 --- a/src/timetable.rs +++ b/src/timetable.rs @@ -383,8 +383,8 @@ pub fn display(timetable: (Vec, (usize, Vec))) { // If the data is too long if course.name.len() > quarter { let data = utils::split_half(&course.name); - next_skip.insert(j, data.1); - print!("{}{:^cl$}", sep, data.0); + next_skip.insert(j, data.1.trim()); + print!("{}{:^cl$}", sep, data.0.trim()); } else { next_skip.insert(j, &course.name); print!("{}{:^cl$}", sep, ""); diff --git a/src/utils.rs b/src/utils.rs index 765e03f..1d49b34 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -98,5 +98,5 @@ pub fn split_half(text: &str) -> (&str, &str) { // Reduce size of string by adding etc. to it, and cutting some info pub fn etc_str(text: &str) -> String { - format!("{}...", split_half(text).0) + format!("{}...", split_half(text).0.trim()) }