From 4e652a157d015345eef8e3de1524c5057d3e14c2 Mon Sep 17 00:00:00 2001 From: Maia Everett Date: Sat, 30 Aug 2025 21:30:27 +0300 Subject: [PATCH 1/2] lowercase: Clarify situation for other languages --- src/strings_ii/lowercase.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/strings_ii/lowercase.md b/src/strings_ii/lowercase.md index d928474..305d7f6 100644 --- a/src/strings_ii/lowercase.md +++ b/src/strings_ii/lowercase.md @@ -1,6 +1,6 @@ # lowercase -In English[^otherlangs] letters can be either lower-cased (`a`, `b`, `c`) or upper-cased (`A`, `B`, `C`). +In English, letters can be either lower-cased (`a`, `b`, `c`) or upper-cased (`A`, `B`, `C`). If you have a `String` which potentially contains upper-cased letters, you can get a new `String` with everything transformed into lower-case using the `.toLowerCase()` method. @@ -16,6 +16,13 @@ void main() { This does not change the original `String` in place. It just makes a new `String` with all lower-case letters. +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: -[^otherlangs]: Other languages also have a notion of case. I am not a polyglot though, so I'm not qualified -to talk about them. \ No newline at end of file +```java,no_run +~void main() { +// Cyrillic +IO.println("ПРИВЕТ".toLowerCase()); // prints "привет" +~} +``` + +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. \ No newline at end of file From 3dc9710863376b339becd03a31fe9d88e007f249 Mon Sep 17 00:00:00 2001 From: Maia Everett Date: Thu, 4 Sep 2025 23:58:30 +0300 Subject: [PATCH 2/2] Remove no_run from Cyrillic example, not needed anymore --- src/strings_ii/lowercase.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strings_ii/lowercase.md b/src/strings_ii/lowercase.md index 305d7f6..3bb24a4 100644 --- a/src/strings_ii/lowercase.md +++ b/src/strings_ii/lowercase.md @@ -18,7 +18,7 @@ This does not change the original `String` in place. It just makes a new `String 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: -```java,no_run +```java ~void main() { // Cyrillic IO.println("ПРИВЕТ".toLowerCase()); // prints "привет"