Arbitrarily long string constants
cpr
I have need to construct a long string constant (of key pairs) that I would like to split over multiple lines. Maybe I'm missing something obvious but none of these work for me in Igor 8.04 (32 bit - windows):
Static StrConstant long_string="blah:blahblah;" + \
"blah2:blahblah2;"
Static StrConstant long_string="blah:blahblah;"
long_string+="blah2:blahblah2;"
Static StrConstant long_string={"blah:blahblah;"}
long_string+="blah2:blahblah2;"
"blah2:blahblah2;"
Static StrConstant long_string="blah:blahblah;"
long_string+="blah2:blahblah2;"
Static StrConstant long_string={"blah:blahblah;"}
long_string+="blah2:blahblah2;"
I could (begrudgingly) just have one giant long line and be done with it were it not for the annoying habit of the scroll bars and cursor vanishing regularly in Igor on my machine - this is 'fixed' buy minimising and maximising Igor BTW.
Is there a trick I'm missing or is this syntax not allowed?
My guess is that line continuation is allowed only in functions.
Maybe use a string function instead:
string str = "blah:blahblah;" + \
"blah2:blahblah2;"
return str
end
August 5, 2020 at 05:17 am - Permalink
Sounds to me as though you are building a list string, perhaps for a popup menu.
I might try a static string function instead of the static string constant.
string rstr
rstr = "bla:blahblah;"
rstr += "foo:foofoo;"
rstr += ...
return rstr
end
August 5, 2020 at 05:19 am - Permalink
Of course, I wondered by all the examples in the linecontinuation help were functions: sometimes 2 + 2 = ~0.
Thank you both.
August 5, 2020 at 09:52 am - Permalink