Codepoint by codepoint in an integer
Uhhh, so clumsy! You need back and forth conversions. You cannot compare against literals like:
and so on. Besides, how do you search for an integer codepoint from a string using Pos() or similar function?
The type "String" is so nice because it behaves like an atomic type. The underlying array nature is hidden in this use case.
Then it becomes a codepoint comparison ch = $4e94. It is faster than a string comparison, too.
If you iterate over Str and compare the codepoints, it would not need Pos.
Alternatively the iterator could use pchar + length. Then it does not need to allocate a new string and can be used with a pos for pchars. I try to replace all temporary string usages with pchar + length.
FLRE, too. One reason why it returns the matches as offset + length, rather than a string