Litterals, strings and operators
Posted: Sat Jun 02, 2018 5:12 am
Just want to make sure I understand here.
If I did something like
the code will fail. When checking the wiki, I looked at operators and see the obvious == for equal but do not see which data types will work with it. Do I assume it is only ints and maybe bools (depending on how they are treated)? Can I assume then that none of the operators listed work on TLOs other than these types? (Clearly operators that are mathematical in nature would not work like bit shifts etc.)
It would seem there are at least 2 options I have found to compare strings; ${String.Equal[litteral - no quotes]} or to check to see if it is a member of a group with ${Select[${ShortName}, NEC, BLAH, ETC]}. Based on my checking macros, these are both not case sensitive. I believe I saw a case sensitive version with String.EqualCS (memory fails if I spelled that right atm). Just for completeness is there a case sensitive version of select or would you have to add an additional toupper or tolower equivalent to get it to work?
How hard would it likely be to put in ==, != overrides like C++ for objects other than ints?
Am I getting the syntax right or am I missing something?
Thanks in advance.
If I did something like
Code: Select all
/varset ShortName ${Me.Class.ShortName}
/if (${ShortName} == "NEC") |** with or without the quotes **|
It would seem there are at least 2 options I have found to compare strings; ${String.Equal[litteral - no quotes]} or to check to see if it is a member of a group with ${Select[${ShortName}, NEC, BLAH, ETC]}. Based on my checking macros, these are both not case sensitive. I believe I saw a case sensitive version with String.EqualCS (memory fails if I spelled that right atm). Just for completeness is there a case sensitive version of select or would you have to add an additional toupper or tolower equivalent to get it to work?
How hard would it likely be to put in ==, != overrides like C++ for objects other than ints?
Am I getting the syntax right or am I missing something?
Thanks in advance.