- 20
- 9
Hello
Maybe someone can covert this c ++ snippet to cleo snippet?
I'm not good with strings in cleo, so i can't do it myself
Maybe someone can covert this c ++ snippet to cleo snippet?
I'm not good with strings in cleo, so i can't do it myself
Код:
#include <iostream>
#include <string>
void ChangeString (std :: string & test)
{
bool inbracket = false;
std :: string outStr;
for (size_t i = 0; i <test.size (); ++ i)
{
char ch = test [i];
if (ch == '[')
inbracket = true;
else
if (ch == ']')
inbracket = false;
else
if (! inbracket)
outStr + = ch;
}
test = outStr;
}
using namespace std;
int main ()
{
std :: string test = "[12] 1234 [56] 78";
ChangeString (test);
cout << test;
}
Последнее редактирование: