Translate metadata to field content

Richard Gaskin ambassador at fourthworld.com
Fri Feb 21 14:08:33 EST 2020


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
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com





More information about the use-livecode mailing list