trim strings

This commit is contained in:
Mylloon 2022-08-23 18:32:06 +02:00
parent cbc17ba85d
commit 744198e66e
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 3 additions and 3 deletions

View file

@ -383,8 +383,8 @@ pub fn display(timetable: (Vec<String>, (usize, Vec<models::Day>))) {
// If the data is too long // If the data is too long
if course.name.len() > quarter { if course.name.len() > quarter {
let data = utils::split_half(&course.name); let data = utils::split_half(&course.name);
next_skip.insert(j, data.1); next_skip.insert(j, data.1.trim());
print!("{}{:^cl$}", sep, data.0); print!("{}{:^cl$}", sep, data.0.trim());
} else { } else {
next_skip.insert(j, &course.name); next_skip.insert(j, &course.name);
print!("{}{:^cl$}", sep, ""); print!("{}{:^cl$}", sep, "");

View file

@ -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 // Reduce size of string by adding etc. to it, and cutting some info
pub fn etc_str(text: &str) -> String { pub fn etc_str(text: &str) -> String {
format!("{}...", split_half(text).0) format!("{}...", split_half(text).0.trim())
} }