Перетворення рядка у нижній регістр

Java:
Перетворення рядка у нижній регістр

How to: (Як це зробити:)

Use toLowerCase() method:

public class LowerCaseExample {
    public static void main(String[] args) {
        String original = "Hello, Друзі!";
        String lowerCased = original.toLowerCase();
        System.out.println(lowerCased);
    }
}

Output:

hello, друзі!

Deep Dive (Поглиблений розбір)

Historically, converting strings to lower case helped normalize data, avoiding mismatches due to case differences. Alternatives include using regular expressions or manually mapping characters, but toLowerCase() is built-in and robust. It considers locale: String.toLowerCase(Locale locale). With this, you can specify how conversion behaves with locale-specific characters.

See Also (Дивіться також)