ASCII
When the Data Integration Service uses ASCII mode, the ASCII function returns the numeric ASCII value of the first character of the string passed to the function.
When the Data Integration Service uses Unicode mode, the ASCII function returns the numeric Unicode value of the first character of the string passed to the function. Unicode values fall in the range 0 to 65,535.
You can pass a string of any size to ASCII, but it evaluates only the first character in the string. Before you pass any string value to ASCII, you can parse out the specific character you want to convert to an ASCII or Unicode value. For example, you might use RTRIM or another string-manipulation function. If you pass a numeric value, ASCII converts it to a character string and returns the ASCII or Unicode value of the first character in the string.
This function is identical in behavior to the CHRCODE function. If you use ASCII in existing expressions, they will still work correctly. However, when you create new expressions, use the CHRCODE function instead of the ASCII function.
Syntax
ASCII ( string )
The following table describes the argument for this command:
Argument | Required/ Optional | Description |
---|
string | Required | Character string. Passes the value you want to return as an ASCII value. You can enter any valid transformation expression. |
Return Value
Integer. The ASCII or Unicode value of the first character in the string.
NULL if a value passed to the function is NULL.
Example
The following expression returns the ASCII or Unicode value for the first character of each value in the ITEMS port:
ASCII( ITEMS )
ITEMS | RETURN VALUE |
---|
Flashlight | 70 |
Compass | 67 |
Safety Knife | 83 |
Depth/Pressure Gauge | 68 |
Regulator System | 82 |