-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add convert module #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very thank you
Cargo.toml
Outdated
@@ -7,5 +7,3 @@ edition = "2018" | |||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |||
|
|||
[dependencies] | |||
lazy_static = "1.4.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do not remove dependencies, we need them in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/convert/mod.rs
Outdated
src.chars() | ||
.map(|v| { | ||
let index = DIGITS[from as usize].iter().position(|&r| r == v); | ||
if index.is_some() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please Instead of if index.is_some()
use if let Some(i) = DIGITS...
src/convert/mod.rs
Outdated
.collect::<String>() | ||
} | ||
|
||
pub fn digits_tofa(src: &str) -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use snake case naming style like digits_to_fa or digits_to_farsi
src/convert/mod.rs
Outdated
digits_convert(src, Lang::En, Lang::Fa) | ||
} | ||
|
||
pub fn digits_toen(src: &str) -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all fixed
thanks |
src.chars() | ||
.map(|v| { | ||
let index = DIGITS[from as usize].iter().position(|&r| r == v); | ||
if let Some(i) = index { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sina-devel We can have a match instead of this, then you can omit the return
added convert module (digit converts) and removed unused libs