pub fn compare_lines(config: Config ) -> Result <() , Box <dyn Error >>
Expand description Comapare two lines with given configuration.
8
9
10
11
12
13
14
15
16
17
18
fn main() -> Result <()> {
println! ("Example with using a single file containing two lines" );
let config = Config::from_file(
false ,
false ,
vec! [' ' ],
PathBuf::from("examples/long-lines.txt" ),
);
println! ("{:?}" , config);
compare_lines (config)
}
More examples Hide additional examples
≺ ≻ 7
8
9
10
11
12
13
14
15
16
17
fn main() -> Result <()> {
println! ("Example without sorting" );
let config = Config::from_lines(false , false , vec! [' ' ], "Hello World" , "World Hello" );
println! ("{:?}" , config);
compare_lines (config)? ;
println! ("Example with sorting" );
let config = Config::from_lines(true , false , vec! [' ' ], "Hello World" , "World Hello" );
println! ("{:?}" , config);
compare_lines (config)
}
≺ ≻ 7
8
9
10
11
12
13
14
15
16
17
fn main() -> Result <()> {
println! ("Example without lowercase" );
let config = Config::from_lines(false , false , vec! [' ' ], "Hello World" , "Hello world" );
println! ("{:?}" , config);
compare_lines (config)? ;
println! ("Example with sorting" );
let config = Config::from_lines(false , true , vec! [' ' ], "Hello World" , "Hello world" );
println! ("{:?}" , config);
compare_lines (config)
}
≺ ≻ 7
8
9
10
11
12
13
14
15
16
17
fn main() -> Result <()> {
println! ("Example without only ';' as separator" );
let config = Config::from_lines(false , false , vec! [' ' ], "Hello;Wor ld" , "Hello;Wor ld" );
println! ("{:?}" , config);
compare_lines (config)? ;
println! ("Example with ';' and ' ' as separators" );
let config = Config::from_lines(false , false , vec! [' ' , ';' ], "Hello;Wor ld" , "Hello;Wor ld" );
println! ("{:?}" , config);
compare_lines (config)
}
≺ ≻ 8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
↕ fn main() -> Result <()> {
println! ("Example with two lines" );
let config = Config::from_lines(false , false , vec! [' ' ], "Hello World" , "hello World" );
println! ("{:?}" , config);
compare_lines (config)? ;
println! ("Example with using a single file containing two lines" );
let config = Config::from_file(
false ,
false ,
vec! [' ' ],
PathBuf::from("examples/twolines.txt" ),
);
println! ("{:?}" , config);
compare_lines (config)
}