aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris2022-11-02 15:05:38 +0100
committerJoris2022-11-02 15:05:38 +0100
commit3fbdc20859a7f795ab9396ead363ab7a9581405d (patch)
treea3033937b6bdf372f218a70ebf8238dee218037b
parentf770efb58c84a78c3bcefc6e8f91b9001ec6d755 (diff)
downloadflashcards-3fbdc20859a7f795ab9396ead363ab7a9581405d.tar.gz
flashcards-3fbdc20859a7f795ab9396ead363ab7a9581405d.tar.bz2
flashcards-3fbdc20859a7f795ab9396ead363ab7a9581405d.zip
Fix reading the deck when it contains a minus
-rw-r--r--src/deck.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/deck.rs b/src/deck.rs
index 70dfda1..82566bd 100644
--- a/src/deck.rs
+++ b/src/deck.rs
@@ -39,7 +39,7 @@ pub fn read(deck: &str) -> Result<Vec<Entry>> {
message: "an entry should starts with “-”.".to_string(),
}));
} else {
- let without_minus = line.split('-').collect::<Vec<&str>>()[1].trim();
+ let without_minus = line.split('-').skip(1).collect::<Vec<&str>>().join("-");
let without_comment = without_minus.split('#').collect::<Vec<&str>>()[0].trim();
let translation = without_comment.split(':').collect::<Vec<&str>>();
if translation.len() != 2 {