diff --git a/src/timetable.rs b/src/timetable.rs
index d30fa40..30fd1d3 100644
--- a/src/timetable.rs
+++ b/src/timetable.rs
@@ -4,7 +4,7 @@ use scraper::{Html, Selector};
use std::collections::HashMap;
use crate::utils::{
- self,
+ self, capitalize,
models::{Position, TabChar},
};
@@ -85,12 +85,14 @@ pub async fn timetable(
}
None => None,
},
- room: course
- .select(&sel_strong)
- .next()
- .unwrap()
- .inner_html()
- .replace("
", ""),
+ room: capitalize(
+ &mut course
+ .select(&sel_strong)
+ .next()
+ .unwrap()
+ .inner_html()
+ .replace("
", ""),
+ ),
start: location_tracker,
size: match course.value().attr("colspan") {
Some(i) => i.parse().unwrap(),
diff --git a/src/utils.rs b/src/utils.rs
index a28e5e4..01b7d90 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -75,7 +75,7 @@ pub fn line_table(
Some(text) => {
println!("{:^cell_length$}{}", text, rsbc_bbc);
last_day = true;
- },
+ }
None => (),
}
} else {
@@ -114,3 +114,12 @@ pub fn split_half(text: &str) -> (&str, &str) {
pub fn etc_str(text: &str) -> String {
format!("{}...", split_half(text).0.trim())
}
+
+// Capitalize string
+pub fn capitalize(text: &mut str) -> String {
+ if let Some(r) = text.get_mut(0..1) {
+ r.make_ascii_uppercase();
+ }
+
+ text.to_string()
+}