PDA

View Full Version : string handling



vijay anandh
5th May 2006, 07:53
Hi All

I am vijay very new to QT , using Vs 2005 with Qt 4. What i want is , I should enter email Id and password in the text fields. But it should be

Username (email address): 128bytes up to the @ and 128 bytes after the @
Password: 128 bytes

this is simple one, but really i dont know what to do. Can you help me

Thanks and regards
vijay

e8johan
5th May 2006, 08:40
I suggest that you use a regular expression using the QRegExp class.

nupul
5th May 2006, 10:02
Hi All

I am vijay very new to QT , using Vs 2005 with Qt 4. What i want is , I should enter email Id and password in the text fields. But it should be

Username (email address): 128bytes up to the @ and 128 bytes after the @
Password: 128 bytes



let me get this right, you want to restrict the size of your input or you want to check the validity of the input (use QRegExp as said above for validation)

this is what you can do :


QString username=user_name_lineEdit->text(); //get text into the string
int size=username.size();


but is this what you want? I request you to be more clear with your requirements

Nupul

wysota
5th May 2006, 10:14
You can restrain the size with a regexp too... Something like that should be used as a validator: QRegExp(".{1,128}@.{1,128}").

zlatko
5th May 2006, 10:15
You also can use simpler way: use 3 lineedits(username,domain,pass),with setting needed maxLenght for everyoen.Look in the attachment :)