Question
· Mar 1, 2023

Is there a way to escape a comma in a comma delimited list? (ObjectScript)

Is there a way to escape a comma in a comma delimited list? (ObjectScript)

Example: In("Connected, Connected, but issues, Not Connected")

(How) can I escape the comma in the 2nd value?

 

Thanks,

Brian

Product version: IRIS 2022.1
Discussion (2)2
Log in or sign up to continue

The In() function in Ens.Util.FunctionSet is documented as searching for a value in a comma-delimited string.

There is undocumented additional functionality for custom separators.

If the items parameter has ",," (two commas) right before the last or second to last character in the string, then the following strings are used as separators.

If there is one character, then that is used as a separator:

w ##class(Ens.Util.FunctionSet).In("a","|a|f|d|c|a,b|a,b,c|,,|")
1

If there are two characters, then those are used as a prefix and suffix for values:

w ##class(Ens.Util.FunctionSet).In("a","<a><b><c><a,b,c>,,<>")
1

Please note that although there is an intention to document this in a future release at some stage, as it is not documented at the moment, it should be used with extreme caution - it may be removed from future versions without warning.