Split by null

Paul Dupuis paul at researchware.com
Thu Jul 23 17:04:22 CEST 2015

On 7/23/2015 1:11 AM, Peter Bogdanoff wrote:
> A heads up:
> 	split tText by cr and null
> works differently in LiveCode 7 than it did in LC 6. The cr parameter is OK, but the null adds another cr when this expression is used in LC 7.

I am trying to understand what the intent is/was of using "and null" as
it seems to be functionally irrelevant in the example stack. i.e. 'split
tText by cr' and 'split tText by cr and null' produce identical results
in LC6

the 'and null' would only be relevant in the split command if you had
array keys separated from array values by nulls in your data (example
below) and using a null as a delimiter seem odd

put "A"&null&"apple"&cr&"B&null&"bottle"&cr&"C"&null"&"cradle"&cr into
split myVariable by cr and null

to presumably get
array[ A ]=apple
array[ B ]=bottle
array[ C ]=cradle

However, the statements above fail in Livecode 6 in that the output you
get is:
array[ 1 ]=A apple
array[ 2 ]=B bottle
array[ 3 ]=C cradle
where the "white space" between A and apple is a null, split fails to do
anything with a null delimiter in LC6 (tested in LC6.7.5)

For data that is just:
Line 1
Line 2
Line 3
the proper syntax seems like it should just be 'split tText by cr'

More information about the use-livecode mailing list