Complementing a qstring of variable length to a maxlength with spaces



  • i have a qstring variable with a variable length content,and i want to complement the qstring in the end with spaces so it will have a constant length of maxlength.
    what is the proper code?


  • Lifetime Qt Champion

    Hi,

    You can create a new QString with the right number of spaces and then append it to your current QString

    QString::QString ( int size, QChar ch ) to construct your space string or you can also use QString::fill

    Hope it helps


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.