Removing square special characters from string

i’m having some string data for categories stored in such format ["Sample String"] and would like to get rid off the square brackets and quotas. Was trying with ifelse() to hardcode the rules. However it’s not working because when i’m utilizing this in formula, QS has syntax errors because of square brackets which aren’t treated as part of the string:

ifelse({ID} = "["Sample String"]", "Sample String")

Is there any better and working solution for such cases?

Thanks in advance.

Hi @Rad
You could use

Something like: SubString({ID},3,Strlen{ID}-2)


1 Like

Thanks @ErikG this would work, however within same ID i’m having values with different lengths, so it would be hard to determine length arguments for the syntax. I’m utilizing contains() function now and it’s retrieving proper values. Thanks for your inputs.

Hi @Rad
if you have “[ at the beginning and ]” at the end the length of the string doesn’t matter as will only use the middle part.

@ErikG you’re right, thanks. The thing is that i can have multiple values stored within ID as well and contains() works better.