You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, February 23rd 2012, 5:13am

convert upper-case to lower-case

Hi all,

I wanted to convert upper-case to lower-case, If any one knows how to do this in qt then please reply.

max2u

Beginner

  • "max2u" is male

Posts: 4

Location: JO

Occupation: Programming

  • Send private message

2

Thursday, February 23rd 2012, 7:42am

Greetings ...
in c++ characters can be treated as numbers, so ill give you a hint :)


int offset = (int)'a' - (int)'A';
for ( /*each character */ )
{
if (character >= 'A' && character <= 'Z')
character= character + offset;
}


and for the looping u can use the QString::length() and QString::at ( int position )


hope it helps :)

3

Thursday, February 23rd 2012, 10:22am

Actually easy:

PHP Source code

1
2
3
QString string "TOLOWERPLEAsE";
QString string2 string.toLower();
//string2 = "tolowerplease"

max2u

Beginner

  • "max2u" is male

Posts: 4

Location: JO

Occupation: Programming

  • Send private message

4

Thursday, February 23rd 2012, 12:52pm

:), ya better way to do it ^_^

Similar threads