Skip to content

codepoint

Description

Converts a Unicode character into its numeric code point representation.

Syntax

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

codepoint(value: string): number
(value: string).codepoint(): number

Arguments

NameTypeRequiredDescription
valuestringtrueThe Unicode character to convert into a numeric code point

Example

Convert a Unicode character into its numeric representation

Consider the following document:

{
    "emoji_value": "❤"
}

Using codepoint, the character can be translated into its numeric value.

create emoji_numeric_value from codepoint(emoji_value)
create emoji_numeric_value from emoji_value.codepoint()

Output

{
    "emoji_value": "❤",
    "emoji_numeric_value": 10084
}