is there a way to "resize" a lib. string? is there a way to limit/set its size to a value?
umm, and yeh, is there a better algorithm to search for all substrings in a string than this one i've made:

for( int i = 0; i < s.length(); i++ )
             for( int j = s.length()-1; j > i; j-- )
                         sub = s.substr( i, j );
// and then the other way

>>is there a way to limit/set its size to a value
No. But if passing it to some other function you can declare it as const so that is can not be changed.

See std::string methods here

To get all substrings

std::string str = "one two three one two three";
while( (pos = str.find("two")) != string::npos)
     string str1 = str.substr(pos,pos+2);
     str = str.substring(pos+2);
    cout << str1 << "\n";
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.