XMM-Newton SAS Home Page
XMM-Newton Science Analysis System


selectlib (selectlib-4.77) [xmmsas_20230412_1735-21.0.0]


Character string constants, operators and functions

Boolean subexpressions may also be formed from character string constants, identifiers that refer to text columns, and a limited set of associated operators and functions. As in C/C++ a string constant is a list of characters enclosed in double quotes ("). A double quote as part of the string must be preceded by a backslash. In addition, string constants may also be given as single-quoted text in which case they may contain un-escaped double quotes but no other single quote. Examples of valid string constants are: "XMM", "", "The double quote:$\backslash$"", 'A single-quoted string with a double quote (")'.

The following string operators and functions are available:

description symbol/name true example expression comment
equality ==, != "X"=="X", "XMM"!="XTE"  
relational operators <, <=, >, >= "a"<"b", "a"<="b", lexicographical order
    "b">"a", "b">="a"  
change case upper/lower upper("Xmm")=="XMM"  
    lower("XMM")=="xmm"  
length strlen strlen("XMM")==3,  
    strlen("")==0  
ASCII value ascii ascii(" ")==32,  
    ascii("Z")-ascii("A")+1==26  
concatenation + "Coca-"+"Cola"=="Coca-Cola"  
range operator [:], [:hi], "XMM"[0:1]=="XM" first character has index 0;
  [lo:], [lo:hi] "FREDDY"[2:]=="EDDY" omitted lower/upper bound
      expands to 0/actual length-1
Please note: The name of a string column can be used everywhere where a string constant is syntactically correct. An error condition will be raised if a numeric column is used in a textual context. All of the above string operators and functions can be arbitrarily nested to form more complex expressions, e.g. (upper(STRCOL1)[:3]+STRCOL2)[5:]==upper(STRCOL3).

XMM-Newton SOC -- 2023-04-16