Re: help using Glib::ustring



Jamiil Abduqadir wrote:
yes, you are right!!
the simple answer is... 'Because I am thinking the OLD wasys'

Thanks man!!

You're welcome. :-)

On Dec 19, 2007 7:05 PM, José Alburquerque < jaalburquerque cox net <mailto:jaalburquerque cox net>> wrote:

    Jamiil Abduqadir wrote:
    > I am porting my old code to Gtkmm, I have started with the most
    > fundamental of applications, a string manipulation class.
    > What I am trying to do is very simple, but the new paradigm has me a
    > bit confused, to convert a string to upper case here is my code
    >
    > const Glib::ustring& jme::strtools::toUpper( const
    Glib::ustring& s ) {
    >     //global variable
    >     tmp.clear();
    >     tmp = s;
    >     //remove non-printable characters
    >     tmp = this->trimIt( tmp );
    >     //Iterate through the string until the end of the is found
    >     for ( Glib::ustring::iterator i = tmp.begin(); i !=
    tmp.end(); ++i ) {
    >         *i = toupper( i ); <<=== the old version
    >     }
    >     return tmp;
    > }
    > i = i.uppercase()  ?? did not work
    > any suggestions?
    >
    If you're writing a string manipulation class (maybe to "flex" your
    programming muscles?), why use classes that already have "string"
    functionality such as Glib::ustring?  On the other hand, you could use
    your "s" variable above the following way to convert the string to
    uppercase: "Glib::ustring upper = s.uppercase()".

    -Jose




--
Happiness has many doors, and when one of them closes another opens, yet we spent so much time looking at the one that is shut that we don't see the one that just opened.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]