Code () Function Error

The Code () function delivers a less-than five digits block for the first character (leftmost) in a string.
The documention text says 5 digits but the sample given further down on the same page contradicts it and FMP18 actually does it like described in the sample. No 5-digits block.

1 Like

That would be expected behavior. There are 2 things in play here.

  1. Unicode is interpreted from Right-to-Left in blocks of 5 characters, with leading zeros.
  2. FileMaker cast the data type as a number, so the first character would drop the leading zeros.

Code ( “a” ) = 97
Char ( 97 ) = a
Char ( “00097” ) = a


Thanks, Joshua!