Skip to content
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

Merged
merged 4 commits into from
Feb 22, 2021
Merged

add convert module #1

merged 4 commits into from
Feb 22, 2021

Conversation

sina-devel
Copy link
Contributor

added convert module (digit converts) and removed unused libs

Copy link
Contributor

@robatipoor robatipoor left a 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"
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

src.chars()
.map(|v| {
let index = DIGITS[from as usize].iter().position(|&r| r == v);
if index.is_some() {
Copy link
Contributor

@robatipoor robatipoor Feb 22, 2021

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...

.collect::<String>()
}

pub fn digits_tofa(src: &str) -> String {
Copy link
Contributor

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

digits_convert(src, Lang::En, Lang::Fa)
}

pub fn digits_toen(src: &str) -> String {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all fixed

@robatipoor robatipoor merged commit 47bb8a8 into rustland-fa:master Feb 22, 2021
@robatipoor
Copy link
Contributor

thanks

src.chars()
.map(|v| {
let index = DIGITS[from as usize].iter().position(|&r| r == v);
if let Some(i) = index {
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants