Translate metadata to field content

Mark Waddingham mark at livecode.com
Fri Feb 21 12:51:29 EST 2020


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 ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list