multi-line constants? (for RSA keys)
Alex Tweedly
alex at tweedly.net
Sat Mar 22 20:35:53 EDT 2014
On 22/03/2014 19:21, Dr. Hawkins wrote:
> RSA keys, as generated, are multiple lines, like
> "-----BEGIN PUBLIC KEY-----"
> "ABC123"
> "DEF456"
> "-----END PUBLIC KEY-----"
>
> I'm trying to do something like
>
> constant mykey= "-----BEGIN PUBLIC KEY-----" \
> & "ABC123"\
> & "DEF456"\
> & "-----END PUBLIC KEY-----"
>
> but it appears that you can't concatenate strings like this . . . (using
> 6.6.0)
>
> Is there a clean solution for this?
>
constant doesn't allow any form of expression, you can't even do
constant mykey = "abc" & "def"
A "clean" solution ?
- assign to a variable instead
- custom prop
- since you're generating it externally - put it in a fixed-name file,
and have your script read that file in
btw if I take the above code, and convert from using a constant to a
variable, I'd get
put "-----BEGIN PUBLIC KEY-----" \
& "ABC123"\
& "DEF456"\
& "-----END PUBLIC KEY-----" into myVar
but that means it's become a single line, instead of 4 lines.
Should it be
put "-----BEGIN PUBLIC KEY-----" &CR& \
& "ABC123" &CR& \
& "DEF456" &CR& \
& "-----END PUBLIC KEY-----" into myVar
??
-- Alex.
More information about the use-livecode
mailing list