I'm trying to make a function that takes an argument should be something like this
string s1 = "[1 -2.5 3;4 5.25 6;7 8 9.12]";
It's supposed to return it to be only the numbers only without the semicolons or the [ and ] and spaces
Like this:
1 -2.5 3 4 5.25 6 7 8 9.12 
So I can later convert the string to float and save them into an array
Any ideas?
#include <iostream>
#include <string>
using namespace std;
string s1 = "[1 -2.5 3;4 5.25 6;7 8 9.12]";
void cutter(string s){
    for(int i=1;i<s.length();i++){
        if(i != s.find(" ") &&  i != s.find(";") ){
            cout << s[i];
            s.erase(0,i-1);
        }
        else if(i == s.find(" ") || i == s.find(";") ){
            cout<<endl;
        }
    }
}
int main()
{
    cutter(s1);
    return 0;
}
 
     
     
     
     
    