- 05 Dec 2024
-
DarkLight
-
PDF
codePointAt
- Updated on 05 Dec 2024
-
DarkLight
-
PDF
codePointAt Task Purpose
The codePointAt task is used to retrieve the Unicode value for a character at a specific position in a string. The result will be a non-negative integer that is the code point value of the character at the given position.
Potential Use Case
This task method helps with multilingual text and localization. Let's say you have a dataset or list that contains a unique set of language characters. To handle the characters properly and compile your data according to the Unicode standard, you would use the codePointAt task and return the code point value for each character.
Properties
Input and output parameters are shown below.
Incoming | Type | Description |
---|---|---|
str |
String | Required. The string to get the Unicode value from. |
pos |
Number | The position of an element in str to return the code point value from. The pos of the first character is 0, the second character is 1, and so on. |
Outgoing | Type | Description |
---|---|---|
codePointValue |
Number | A number representing the code point value of the character at the given pos . If there is no character at the given pos , the task will return undefined. |
Example
In this example , the incomingstr
is given the Reference variable of Hello World. The pos
number is "1", which equates to the letter "e" in the phrase "Hello World".
Remember, the first character position is 0, and the second character position is 1, and so on.
The codePointValue
that returns upon output is "101", which is the Unicode value that represents the small letter "e".