Characters that can be used in an array key

Dar Scott dsc at swcp.com
Mon Apr 30 16:02:25 EDT 2012


On Apr 30, 2012, at 1:24 PM, Jerry Jensen wrote:
> On Apr 30, 2012, at 8:54 AM, Richard Gaskin wrote:
>> 
>> it seems that the only character we must avoid in array keys is NULL, since that's used internally as a delimiter between the key and the value.
>> 
>> As far as I can tell, all other characters are allowable.
> 
> It would be fun to see how the script editor handles keys that are made of return characters.

This is part of the general consideration of referring to new-line characters in LiveCode.

You can always do this:

	put "abc" & LF & "def" into key1
	-- you can replace LF with return, CR, or linefeed, but I recommend against CR

You can define NL or newLine if you want, too.

The parsing for a literal string that is the first parameter of format() is special and you can do this:

	put format("abc\"def") into key1

For multiple lines you can do this:

	get "Give up? Give up? " & lf & \
	"The day may come when we'll give up " & lf & \
	"on fruitless searches after a mere eleven minutes, " & lf & \
	"but that day is not today!"

Or you can use some text-builder helper commands:

	startTextBuilding
	build "Give up? Give up? "
	build "The day may come when we'll give up "
	build "on fruitless searches after a mere eleven minutes, "
	build "but that day is not today!"
	get builtText()

And of course some functions will put a new-line into output:

	put base64encode(bigSecretID) into key1

There is no need to strip the LF characters from the key if used as an array key if you are consistent.  (But always strip when doing BASIC auth.)

Dar Scott







---------------------------
Dar Scott
dba 
Dar Scott Consulting
8637 Horacio Place NE
Albuquerque, NM 87111

Lab, home, office phone: +1 505 299 9497
For Skype and fax, please contact.
dsc at swcp.com

Computer Programming and tinkering,
often making LiveCode libraries and
externals, sometimes writing associated
microcontroller firmware.  
---------------------------







More information about the use-livecode mailing list