SuperCard 4.8 Enhanced Offset Function

Need help with a script? This is the place to discuss how to get your code running!

SuperCard 4.8 Enhanced Offset Function

Postby codegreen » Tue Mar 29, 2016 11:01 am

SuperCard 4.8b11 adds a new option to the venerable offset string utility function.

The syntax looks just the same as before:

Code: Select all
  get offset(<textToFind>, <textToLookIn> [, <startChar>])

The difference is that now you can pass a negative number for startChar to search from the right end of textToLookIn (instead of the left) for textToFind. To start all the way at the right end, pass -0:

Code: Select all
  put offset("d", "Howdy!")      -- 4
  put offset("d", "Howdy!", 0)   -- 4
  put offset("d", "Howdy!", 1)   -- 3
  put offset("d", "Howdy!", -0)  -- 3
  put offset("d", "Howdy!", -1)  -- 2

Posts: 1534
Joined: Mon Jul 14, 2008 11:03 pm

Return to Scripting in SuperTalk

Who is online

Users browsing this forum: No registered users and 1 guest