Reference · Strings

upper

signature
upper(str) -> str

What it does

The text in upper case. It knows all of Unicode, so letters outside ASCII are converted too, and a letter that grows when capitalised does: "ß" becomes "SS". Digits, punctuation and whitespace stay as they are.

Examples

print(upper("hello"))print(upper("straße"))print(upper("Ærøskøbing 42, ok?"))
output
HELLOSTRASSEÆRØSKØBING 42, OK?

Edge cases

print(upper(""), len(upper("ß")))print(upper("fi") == "FI")
output
 2true

Errors

An argument that is not a string is a runtime error, not an error value: upper(42) stops the request. Convert first with str.

this one fails
print(upper(42))
output
line 1: `upper` expects a str as argument 1, got int

Chaining

In a pipeline the text comes first, so upper takes it as its only argument:

print("  mixed Case  " | trim | upper)print(["ann", "bob"] | map(upper))
output
MIXED CASE["ANN", "BOB"]

See also

lower, trim, str

Thread
7Useful? Like it, or add to its thread below.

Thread 0 posts

On upper(): 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