diff options
Diffstat (limited to 'src/util/serialization.rs')
-rw-r--r-- | src/util/serialization.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util/serialization.rs b/src/util/serialization.rs new file mode 100644 index 0000000..fcb3062 --- /dev/null +++ b/src/util/serialization.rs @@ -0,0 +1,7 @@ +pub fn line_to_words(line: &String) -> Vec<String> { + line.split("|").map(|w| w.trim().to_string()).filter(|w| !w.is_empty()).collect() +} + +pub fn words_to_line(words: &Vec<String>) -> String { + words.join(" | ") +} |