I have strings like that;
a-variable-part[]
another-string[x]
without knowing the length of each string i want to separate the first part of the string from what there’s inside []
in the examples above I want to get:
- “a-variable-part”, “”
- “another-string”, “x”
do you know how?
If you run this:
it will give you an array of two elements:
["another-string", "x"]