How to find the offset of the first character in a string that's not a tab?
Keith Clarke
keith.clarke at me.com
Thu Jan 21 05:34:08 EST 2021
Thanks Dick, this would definitely work - and I’m iterating through characters and lines anyway as I attempt to prettify a long data string for eased human readability.
I was just keen to understand why offset wasn’t happy with the ‘not(tab)’ in this instance.
Best,
Keith
> On 21 Jan 2021, at 10:25, Dick Kriesel via use-livecode <use-livecode at lists.runrev.com> wrote:
>
>
>> 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
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list