trim instead of replace
This commit is contained in:
parent
fbca249149
commit
9d1885b245
@ -204,7 +204,7 @@ impl QuestionsParser {
|
||||
self.last_keyword_type = self.cur_keyword_type;
|
||||
self.last_tag = self.cur_tag.clone();
|
||||
self.cur_keyword_type = Some(keyword.parse().unwrap());
|
||||
self.cur_tag = keyword.replace(' ', "").replace(':', "");
|
||||
self.cur_tag = keyword.trim_end().trim_end_matches(':').to_string();
|
||||
}
|
||||
/// if line matched keyword
|
||||
fn on_keyword_match(&mut self, line: &str, keyword: &str) {
|
||||
@ -212,7 +212,7 @@ impl QuestionsParser {
|
||||
|
||||
// remember question id
|
||||
if let Some(KeywordType::QuestionStart) = self.cur_keyword_type {
|
||||
self.cur_question_pre["id"] = line.replace(':', "").into();
|
||||
self.cur_question_pre["id"] = line.trim_end().trim_end_matches(':').into();
|
||||
};
|
||||
|
||||
self.apply_content_for_last_keyword();
|
||||
|
Loading…
Reference in New Issue
Block a user