Accessing the last item in a line

Pete pete at mollysrevenge.com
Mon Aug 22 13:14:18 EDT 2011


Unfortunately, I don't know in advance how many items there are in the
string, probably didn't explain that clearly but the root of the problem is
that I have to refer to item -1 of the string and  "a,b,c" returns "c" and
"a,b," returns "b" - same number of delimiters, different result.

Wasn't there a thread about something like this recently, ending up with
there being a bug (or at least a change in behavior) that was introduced in
a recent LC release?  I think it was to do with adding an item/line to an
existing string.

Anyway, I've filed this away in my folder of things to be aware of in LC,
and got around the problem by using an array instead of a list of items. In
the example above, key 3 of the array contains either "c" or is empty, but
at least it's there!


Pete
Molly's Revenge <http://www.mollysrevenge.com>





> I think most would agree that the second example still has only two lines,
> regardless of the trailing return character. If you ask for line 3 in either
> example, you will get empty. For your project, asking for item 3 will also
> return empty, so that's how you know.
>
> --
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
>
>
> ______________________________**_________________
> 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<http://lists.runrev.com/mailman/listinfo/use-livecode>
>
>



More information about the use-livecode mailing list