
cbiso (cbiso) asked a question.
I have the following string "ST,NT" that I want to convert to an array. Since there is no split function, I'm trying to replace the comma with quotation marks. But the expression language keeps inserting backslashes
String.replace("ST,NT", ",", '","') returns "ST\",\"NT"
Desired output "ST","NT"

Hello @cbiso (cbiso),
Please check the following link with information: https://support.okta.com/help/s/article/What-String-function-should-I-use-that-only-returns-alphabetical-characters-with-no-apostrophe?language=en_US
Regards,
Natalia
Okta Inc.
The toLowerCaseFunction won't remove the backslashes.
My input string that is coming from a different system is formatted as “ST,NT”
I’m trying to use the string replace function to output "ST","NT" (but is inserting the backslashes)
I also tried the suggestion here, but still does not giving the desired output
https://support.okta.com/help/s/article/How-to-convert-string-to-array-using-Okta-Expression-Language?language=en_US
If I double up the quotes, the preview shows the backslashes (which are escape characters), but it looks correct on the profile page.
{'""' + String.replace(appuser.extensionAttribute9, ",", '"",""') + '""'}
Preview Page:
I was more expecting for the values to be treated as array elements and look like this....
I guess I have to modify the upstream value in active directory to be "ST","NT" so it will be interpreted properly. The okta expression language doesn't appear to have a way to convert it.
Hello @cbiso (cbiso) , Please use the following link documentation from Okta Expression language as a reference. https://developer.okta.com/docs/reference/okta-expression-language/
If you need more assistance, please open a case with Okta support.