I have strings and I need to make doubles from them. They’re all in format:
"Blabla 11/moreBla 17-18" That should become 11.1718
"Blabla 7/moreBla 8-9" --> 7.89
"Blabla 4/moreBla 6-8" --> 4.68
etc.
There could also be extra spaces or dash could be a forward slash. So, anything like that:
"Blabla 11/moreBla 17-18"
"Blabla 11 / moreBla 17-18"
"Blabla 11/moreBla 17/18"
"Blabla 11/moreBla 17 / 18"
"Blabla 11 / moreBla 17 / 18"
I tried splitting the string first, but then apparently there are all these other cases. So split isn’t working well here. Maybe RegEx could be of help?
Code:
Output:
Test this code here.
Or this code:
Output:
Test this code here.