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. These interchangeable forms allow flexibility in how you structure expressions.
- Function notation
- Method notation
codepoint(value: string): number
(value: string).codepoint(): number
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
value | string | true | The Unicode character to convert into a numeric code point |
Example
Convert a Unicode character into its numeric representation
Using codepoint, the character can be translated into its numeric value. Consider the following document:
Example data
{
"emoji_value": "❤"
}
Example query
- Function notation
- Method notation
create emoji_numeric_value from codepoint(emoji_value)
create emoji_numeric_value from emoji_value.codepoint()
Example output
{
"emoji_value": "❤",
"emoji_numeric_value": 10084
}