Jak usunąć wielokrotność spacji?

0

Jak usunac wielokrotnosc spacji uzywajac metod? Jak na razie moj program usuwa tabulature.

fstream input(argv[1]);
    ofstream output(argv[2]);
    string line;
    while(getline(input, line))
    {
    transform(line.begin(), line.end(), line.begin(), ::toupper);
    replace( line.begin(), line.end(), '\t', ' ' );
//    line.replace('\t',' ');

    cout << line;
    cout << endl;

Czyli tak:
Mam jakis tekst ktory zawiera duzo spacji i tabulatur. Na razie usuwam tabbulatury, pozniej chcialbym usunac dodatkowe spacje.

0

nastepnie uzyj regexa
https://regex101.com/r/vsLEHJ/1
(usuwasz grupe)

1 użytkowników online, w tym zalogowanych: 0, gości: 1