Mark Waddingham wrote:

> 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.).

Super - thanks.  Any faster than byteoffset?


>> How might we use codeunits with offset()?
>
> You wouldn't - you would use codeunitOffset instead.

OMG! How did I miss that addition? Thank you! That's going into use this weekend.


> 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.

Good to know - thanks.

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 ____________________________________________________________________
 ambassa...@fourthworld.com                http://www.FourthWorld.com


_______________________________________________
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