File tree 2 files changed +8
-3
lines changed
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -112,8 +112,13 @@ pub fn reverse_polish_parsing(infix_input: &String)->Result<Vec<String>>{
112
112
if index > 0 && !infix_as_chars[ index - 1 ] . is_digit ( 10 ) || index == 0 {
113
113
next_output_value_num. push ( '0' ) ;
114
114
}
115
-
116
- next_output_value_num. push ( * chr) ;
115
+ //we want to support both . and , but , is not supprted so we have to convert it to .
116
+ if * chr == ',' {
117
+ next_output_value_num. push ( '.' ) ;
118
+ }
119
+ else {
120
+ next_output_value_num. push ( * chr) ;
121
+ }
117
122
118
123
}
119
124
else if chr. is_alphabetic ( ) {
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ use std::time::Instant;
3
3
4
4
fn main ( ) {
5
5
let before = Instant :: now ( ) ;
6
- let value: Vec < String > = match lib:: reverse_polish_parsing ( & ".8+.7+((2^2)*3-1)-(2^2)+2-sqrt(5*7+3)" . to_string ( ) ) {
6
+ let value: Vec < String > = match lib:: reverse_polish_parsing ( & ".8+.7+7,7+ ((2^2)*3-1)-(2^2)+2-sqrt(5*7+3)" . to_string ( ) ) {
7
7
Ok ( a) => a,
8
8
Err ( e) => { println ! ( "Error {:?}" , e) ; return ; } ,
9
9
} ;
You can’t perform that action at this time.
0 commit comments