From fbdeaed50be59a5b9574674a51bede021458c45c Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sun, 31 May 2020 15:38:44 -0700 Subject: implement group delimiter character --- src/bin/aft-demo.rs | 14 +++++++------- src/bin/aft.rs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bin/aft-demo.rs b/src/bin/aft-demo.rs index 9a680c1..ead5089 100644 --- a/src/bin/aft-demo.rs +++ b/src/bin/aft-demo.rs @@ -18,18 +18,18 @@ fn main() { print!("\x01"); // colum names - println!("{}", ["Sepal length", "Speal width", "Petal length", "Petal width", "Species"].join("\x1E")); + println!("{}\x1D", ["Sepal length", "Speal width", "Petal length", "Petal width", "Species"].join("\x1E")); // colum types - println!("{}", ["float", "float", "float", "float", "str"].join("\x1E")); + println!("{}\x1D", ["float", "float", "float", "float", "str"].join("\x1E")); // end header / start table print!("\x02"); // print rows - println!("{}", ["5.1", "3.5", "1.4", "0.2", "I. setosa"].join("\x1E")); - println!("{}", ["4.9", "3.0", "1.4", "0.2", "I. setosa"].join("\x1E")); - println!("{}", ["4.7", "3.2", "1.3", "0.2", "I. setosa"].join("\x1E")); - println!("{}", ["4.6", "3.1", "1.5", "0.2", "I. setosa"].join("\x1E")); - println!("{}", ["5.0", "3.6", "1.4", "0.2", "I. setosa"].join("\x1E")); + println!("{}\x1D", ["5.1", "3.5", "1.4", "0.2", "I. setosa"].join("\x1E")); + println!("{}\x1D", ["4.9", "3.0", "1.4", "0.2", "I. setosa"].join("\x1E")); + println!("{}\x1D", ["4.7", "3.2", "1.3", "0.2", "I. setosa"].join("\x1E")); + println!("{}\x1D", ["4.6", "3.1", "1.5", "0.2", "I. setosa"].join("\x1E")); + println!("{}\x1D", ["5.0", "3.6", "1.4", "0.2", "I. setosa"].join("\x1E")); } diff --git a/src/bin/aft.rs b/src/bin/aft.rs index 0ada921..25aa0f7 100644 --- a/src/bin/aft.rs +++ b/src/bin/aft.rs @@ -97,7 +97,7 @@ fn main() -> Result<(), Box> { writeln!(tw, "{}", header.col_names.join("\t").bold())?; for line in stdin.lines() { let line = line?; - writeln!(tw, "{}", line.replace("\x1E", "\t"))?; + writeln!(tw, "{}", line.replace("\x1E", "\t").replace("\x1D", ""))?; } tw.flush()?; -- cgit v1.2.3