Skip to content

toUpperCase - Convert string value to upper Case

The toUpperCase function will convert characters in a string to their uppercase variants.

Syntax

toUpperCase(value: string): string

Arguments

Name Type Required Description
value string true The string to transform to upper case

Example - Ensuring consistent UUIDs

Consider the following document:

{
    "uuid1": "37367559-35f4-459c-943e-19025765da15"
    "uuid2": "37367559-35F4-459C-943E-19025765DA15"
}

We can see that both uuid1 and uuid2 refer to the same ID, but a direct comparison would yield false because they are in different cases. toUpperCase can be used to ensure casing is taken out of the equation when performing direct comparisons of UUID string values.

filter uuid1.toUpperCase() == uuid2.toUpperCase()

This will keep only those logs where uuid1 and uuid2 are the same, case insensitive.