On 2020-02-21 17:22, Richard Gaskin via use-livecode wrote:
This is an interesting detail.  Is it safe to surmise from this that
in cases where speed is important we should consider using codeunits
instead of chars?

Yes - especially if searching for non-letter chars as delimiters (e.g. return, space, ':' etc.).

How might we use codeunits with offset()?

You wouldn't - you would use codeunitOffset instead.

Note: The dictionary entry for codeunitOffset is heinously wrong! The needle string can be any length, and the return value is *always* relative to the start of the string (its not quite the same as offset):

e.g. codeunitOffset("foo", "barfoo", 2) = 4 (not 2 - as would be the case with offset).

Another Note: In the general case codeunit counts <> codepoint counts <> character counts - although for native strings they are all the same, though.

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to