I have a string User name (sales)
and I want to extract the text between the brackets, how would I do this?
I suspect sub-string but I can't work out how to read until the closing bracket, the length of text will vary.
I have a string User name (sales)
and I want to extract the text between the brackets, how would I do this?
I suspect sub-string but I can't work out how to read until the closing bracket, the length of text will vary.
The
regex
method is superior I think, but if you wanted to use the humblesubstring
or
Regular expressions might be the best tool here. If you are not famililar with them, I recommend you install Expresso - a great little regex tool.
Something like:
Here is a general purpose readable function that avoids using regex:
To call it in your particular example you can do: