I just installed Ubuntu and these 2-3 days I haven't been able to log in here. I had a thread opened here. The problem is solved now, so forgive me for not telling about it.
What I want to do now is to get strings from a string. If I have the following string:
" this + that - anotherOne + again ",
then I am going to have a string called "this", another one called "that", and so on, without the spaces. here is my code:
Code:
vector<string> siruriCitite;
void f(string sir)
{
int pointer = 0;
int length = sir.length();
int found = 0;
int firstLetter, lastLetter;
int dimension = 0;
do
{
firstLetter = sir.find_first_not_of(" ", found + 1);
lastLetter = sir.find_last_not_of(" ", found + 1);
for(pointer = found; pointer < length; pointer++)
{
if(sir[pointer] == '+' || sir[pointer] == '-' || sir[pointer] == '/')
{
found = pointer;
break;
}
}
siruriCitite.resize(dimension + 1);
siruriCitite[dimension] = sir.substr(firstLetter, lastLetter);
dimension++;
}
while(pointer < length);
}
After running in main : f("CradleofFilth + TheCruxshadows - Ubuntu / SoporAeternus") and then
Code:
int l = siruriCitite.size();
for(int i = 0; i < l; l++)
{
cout << siruriCitite[l] << endl;
}
, nothing happens. It's like an infinite loop. Also, the operating system almost crashes.. Thank you in advance for your time ..