Reference · Strings
lower
signature
lower(str) -> strWhat it does
The text in lower case. It knows all of Unicode, so letters outside ASCII are converted too: Greek, Cyrillic and accented letters alike. Digits, punctuation and whitespace stay as they are.
Examples
print(lower("HELLO"))print(lower("ÆRØ 42, OK?"))print(lower("ΑΒΓ"), lower("Straße"))output
helloærø 42, ok?αβγ straßeEdge cases
- The empty string gives the empty string.
- The result can be longer than the text: a Turkish dotted
İbecomesiwith a combining dot, two characters. - A final Greek sigma lowers to
ς, notσ: the rule is positional. upperandlowerdo not always round-trip:upper("ß")isSS, which lowers toss. For a case-insensitive comparison, lower both sides.
print(lower(""), len(lower("İ")))print(lower("ΣΑΣ"))print(upper("ß") | lower)print(lower("Ab") == lower("aB"))output
2σαςsstrueErrors
An argument that is not a string is a runtime error, not an error value: lower(42)
stops the request. Convert first with str.
this one fails
print(lower(42))output
line 1: `lower` expects a str as argument 1, got intChaining
In a pipeline the text comes first, so lower takes it as its only argument:
print(" Mixed Case " | trim | lower)print(["Ann", "BOB"] | map(lower))print(["img.png", "a.jpg", "b.PNG"] | filter((f) => lower(f) | ends_with(".png")))output
mixed case["ann", "bob"]["img.png", "b.PNG"]See also
Thread
Thread 0 posts
On lower(): questions, tips, corrections, and code that uses it.
No posts yet. The first one opens the thread.
Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo