Skip to content

Commit b6016b9

Browse files
authored
Merge pull request #120 from Maia-Everett/lowercase
lowercase: Clarify situation for other languages
2 parents ae7acbf + c93e33b commit b6016b9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/strings_ii/lowercase.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# lowercase
22

3-
In English[^otherlangs] letters can be either lower-cased (`a`, `b`, `c`) or upper-cased (`A`, `B`, `C`).
3+
In English, letters can be either lower-cased (`a`, `b`, `c`) or upper-cased (`A`, `B`, `C`).
44

55
If you have a `String` which potentially contains upper-cased letters, you can get a new `String` with everything
66
transformed into lower-case using the `.toLowerCase()` method.
@@ -16,6 +16,13 @@ void main() {
1616

1717
This does not change the original `String` in place. It just makes a new `String` with all lower-case letters.
1818

19+
What about other languages? Many of them also have a distinction between uppercase and lowercase, and usually, `.toLowerCase()` does the right thing for them too:
1920

20-
[^otherlangs]: Other languages also have a notion of case. I am not a polyglot though, so I'm not qualified
21-
to talk about them.
21+
```java
22+
~void main() {
23+
// Cyrillic
24+
IO.println("ПРИВЕТ".toLowerCase()); // prints "привет"
25+
~}
26+
```
27+
28+
However, in different languages, the mapping between uppercase and lowercase characters can differ. For example, in Turkish, the lowercase form of the letter `I` is `ı` without a dot. By default, Java uses the rules for the language of the operating system, so `"I".toLowerCase()` will return `"i"` on an English system and `"ı"` on a Turkish one.

0 commit comments

Comments
 (0)