1use std::io;
2
3pub(crate) fn wait_input_sync() -> String {
4 let mut input = String::new();
5 match io::stdin().read_line(&mut input) {
6 Ok(_) => input.trim().to_string(),
7 Err(e) => panic!("Can not get input value: {:?}", e),
8 }
9}
10
11pub(crate) fn split_string(input: String, sep: char) -> Option<(String, String)> {
12 let found: Vec<&str> = input.splitn(2, |c| c == sep).collect();
13 if let 2 = found.len() {
14 let f = found.first().unwrap().trim();
15 let s = found.get(1).unwrap().trim();
16 if !f.is_empty() && !s.is_empty() {
17 return Some((f.to_string(), s.to_string()));
18 }
19 }
20 None
21}