I have the string:
var str = "Quantidade [12]";
I need to retrieve the string but remove the space and [12], ie I need to return only the value: Quantity .
In case the string is var str = "Quantidade máxima [12]";
, I need to get all the text to the left of the bracket, that is, the value Max amount .
Both the size of the strings and the value between the brackets can change, the mask would be basically:
var str = "string [*]";
I will always have only this pair of brackets and a numeric value inside. How can I recover the entire string by removing space and numeric value?