-
Notifications
You must be signed in to change notification settings - Fork 94
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 parts of methods for Char. #1494
base: main
Are you sure you want to change the base?
Conversation
I'll analyze the git diff and point out potential issues I've observed:
The condition
These are potential issues that might need attention, though they may be intentional design choices depending on the requirements of the codebase. |
Pull Request Test Coverage Report for Build 4815Details
💛 - Coveralls |
char/char.mbt
Outdated
(v >= 65 && v <= radix + 65 - 11) || | ||
(v >= 97 && v <= radix + 97 - 11), | ||
) | ||
_ => None |
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.
This is false
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.
What does 'This' refer to?
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.
he probaly means it should return Bool
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.
is_digit('1', 100) == None
==> is_digit('1', 100) == true
_ => None
==>
1 => false
11..<_ => (v >= 48 && v <= 57) ||
(v >= 65 && v <= radix + 54) ||
(v >= 97 && v <= radix + 86)
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.
or maybe we can simply just panic if you want to follow the Rust's way
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.
Or else, you can just follow the Java's API: https://docs.oracle.com/javase/8/docs/api/java/lang/Character.html#isDigit-int-
This condition. If it’s not number nor ascii, it’s certainly not a digit.
|
///| Checks if the value is an ASCII uppercase character: | ||
/// U+0041 ‘A’ ..= U+005A ‘Z’ | ||
pub fn is_ascii_uppercase(self : Char) -> Bool { | ||
self >= 'A' && self <= 'Z' |
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.
you can pattern match over char too.
match self {
'A'..='Z' => true
_ => false
}
2fd1fa1
to
5c14170
Compare
Related issue: #1487