8000 Functions for upper / lower casing ASCII characters in strings. by TristonianJones · Pull Request #372 · google/cel-go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Functions for upper / lower casing ASCII characters in strings. #372

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

Merged
merged 2 commits into from
Jul 8, 2020

Conversation

TristonianJones
Copy link
Collaborator

This change introduces extension functions for upper / lower casing ASCII characters in strings.

Closes #370

@TristonianJones TristonianJones requested a review from JimLarson July 2, 2020 17:51
@TristonianJones
Copy link
Collaborator Author

FYI @bitsofinfo regarding tektoncd/triggers#638

@TristonianJones TristonianJones changed the title Functions for upper / lower ASCII characters in strings. Functions for upper / lower casing ASCII characters in strings. Jul 2, 2020
Copy link
Contributor
@JimLarson JimLarson left a comment

Choose a reason for hiding this comment

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

Just some minor changes to consider.

ext/README.md Outdated
@@ -64,6 +63,20 @@ Examples:
'hello mellow'.lastIndexOf('ello', 6) // returns 1
'hello mellow'.lastIndexOf('ello', -1) // error

### LowerAscii

Produces a new string where all ASCII characters are lower-cased.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Returns" instead of "produces", for consistency. (Okay, I see "produces" elsewhere, but let's start converging on "returns".) Here and elsewhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

ext/strings.go Outdated
func lowerASCII(str string) string {
runes := []rune(str)
for i, r := range runes {
if r&unicode.MaxASCII == r {
Copy link
Contributor

Choose a reason for hiding this comment

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

if r <= unicode.MaxASCII seems to be more idiomatic, but I'm okay with it as-is. Here and below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@TristonianJones TristonianJones merged commit 1091cb0 into google:master Jul 8, 2020
@TristonianJones TristonianJones deleted the string-casing branch July 8, 2020 20:49
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.

strings: add string casing functions
2 participants
0