Click the links below to explore the different sections of our site. If you have any questions about our products or services, don't hesitate to contact us.
Following are a number of links to pages that might interest you as a visitor of this web site.
copyright © 2005-07 by Mark Schonewille & Economy-x-Talk

Economy-x-Talk - Sample Scripts

Case Sensitive Offset w/delete

HyperTalk case sensitive offset function.





-- M. Uli Kusterer
function caseSensOffset ch,inTxt
  put false into foundSomething
  put 0 into relOffset
  put length(ch) into chLen -- keep us from repeating this inside loop
  repeat until foundSomething
    put offset(ch,inTxt) into thePos
    if thePos = 0 then -- no match
      put true into foundSomething
      put 0 into returnOffset
    else -- we have a match, now check case
      put char thePos to thePos +chLen -1 of inTxt into foundTxt
      if foundTxt > ch or foundTxt < ch then -- case mismatch :-(
        delete char 1 to thePos of inTxt
        -- above, we don't delete "1 to thePos +chLen -1" or else
        -- we would get wrong results when, e.g. ch = "AA" and inTxt = "aAA"
        add thePos to relOffset
      else -- case matches
        put true into foundSomething
        put thePos +relOffset into returnOffset
      end if
    end if
  end repeat
  return returnOffset
end caseSensOffset





Keep this extensive resource of tutorials and samples on-line! Support RunRev.info!
Yes, this script is useful. I make a donation and choose freely how much I want to donate on-line (PayPal). Click here if you want to make a donation in dollars.This script has not (completely) solved my problem and I want Economy-x-Talk to take care of it. Let me contact you.
Copyright©2002-2008 by Mark Schonewille, Nijmegen, the Netherlands. This web site is in no way affiliated with Runtime Revolution Ltd., but we do recommend the Revolution development platform.