Skip to content

Commit

Permalink
Merge pull request #2364 from rust-lang/gh2148
Browse files Browse the repository at this point in the history
Mention that to_lowercase isn't perfect
  • Loading branch information
steveklabnik authored Jun 7, 2020
2 parents d899c0f + 82892bf commit f20232b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ch12-05-working-with-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ function to lowercase the query and the line before comparing them</span>
First, we lowercase the `query` string and store it in a shadowed variable with
the same name. Calling `to_lowercase` on the query is necessary so no matter
whether the user’s query is `"rust"`, `"RUST"`, `"Rust"`, or `"rUsT"`, we’ll
treat the query as if it were `"rust"` and be insensitive to the case.
treat the query as if it were `"rust"` and be insensitive to the case. While
`to_lowercase` will handle basic Unicode, it won't be 100% accurate. If we were
writing a real application, we'd want to do a bit more work here, but this section
is about environment variables, not Unicode, so we'll leave it at that here.

Note that `query` is now a `String` rather than a string slice, because calling
`to_lowercase` creates new data rather than referencing existing data. Say the
Expand Down

0 comments on commit f20232b

Please sign in to comment.