Skip to content

toLowerCase - Change all characters in a string to lower case

The toLowerCase function transforms a string and ensures that all alphabetical characters in the string are lower case.

Syntax

Like many functions in DataPrime, toLowerCase supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.

toLowerCase(value: string): string
value: string.toLowerCase(): string

Arguments

NameTypeRequiredDescription
valuestringtrueThe string to transform to lower 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. toLowerCase can be used to ensure casing is taken out of the equation when performing direct comparisons of UUID string values.

filter toLowerCase(uuid1) == toLowerCase(uuid2)
filter uuid1.toLowerCase() == uuid2.toLowerCase()

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