How to find the offset of the first character in a string that's not a tab?

Dick Kriesel dick.kriesel at mail.com
Thu Jan 21 05:25:33 EST 2021


> On Jan 21, 2021, at 1:30 AM, Keith Clarke via use-livecode <use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>> wrote:
> 
> Please can anyone advise on the correct syntax for trying to find the first non-tab character offset in a string

Hi, Keith.  You could test each character until you find a tab:

function offsetOfNotTab pString
 local i
 repeat for each char tChar in pString
    add 1 to i
    if tChar <> tab then return i
 end repeat
end offsetOfNotTab

— Dick


More information about the use-livecode mailing list