At 5:32 PM -0400 9/28/01, Raymond E. Griffith wrote:
>> Now here's my question:  What's the most efficient way to parse a chunk of
>> data into every four characters and discard the first one?   So many ways to
>> slice that one, and I haven't had time lately to run routines through
>> MetaBench....
>> 
>
>Hmmm. What about...
>
>repeat with i = 1 to length(tstr) div 4
>  put char 4*i-2 to 4*i of tstr into item i of tparsed
>end repeat  
>
>Raymond

Throwing out another example, how about this -- it's more verbose, but probably a lot 
faster for large inputs:

  put the imagedata of image tSomeImage into tStr
  put 0 into tCharCount
  put empty into tColors
  repeat for each char X in tStr
    add 1 to tCharCount
    switch tCharCount
    case 1
      break
    case 4
      put charToNum(X) & cr after tColors
      put 0 into tCharCount
      break
    default
      put charToNum(X) & "," after tColors
    end switch
  end repeat
  put tColors into fld tSomeField


regards,

geoff


Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to