If str is a String or a ZString, the UByte value at that position is returned. This will be a 7-bit ASCII code, or even a 8-bit character value from some code-page, depending on the string data stored in str.

If str is a WString, the UShort (Windows) or ULong (Linux) value at that position is returned. This will be a 16bit value on Windows (WStrings use UTF16 there), or a 32bit value on Linux (WStrings use UTF32 there).

The function returns zero (0) if the string is a zero length string, position is less than one (1), or position is greater than the number of characters in str.

Chr performs the opposite function for ASCII strings, while WChr is the opposite for Unicode strings, returning a string containing the character represented by the code passed as an argument.