Issue
I have strings like these
total sales 234 rs
total cost 651 rs
and I want to get only
end result should look like this
total sales
total cost
how can i get that please help thanks
Solution
Assuming you always want to cut it off just before the first number, you could find the index of the first number:
const index = 'total sales 234 rs'.search(/\d/);
And then just get the substring:
substring(0, index - 1);
Answered By – Lucas LaRocco
Answer Checked By – Clifford M. (BugsFixing Volunteer)