Alternative to QString::sprintf()



  • So Gentlemen,

    How might I do the equivalent of this without using QString::sprintf ?

    sprintf(buf,"%s%d%s",prefix,intval,suffix);
    

    please let me have your ideas.

    Thanks.


  • Moderators

    Kenchan, for future reference, please try to open new posts rather than reopening ages-old ones. I'm going to move this question to its own thread for you.

    In your case, you could use something like:
    @
    QString foo = QString("%1%2%3").arg(prefix).arg(intval).arg(suffix);
    @
    or something. Be sure and look at the docs for QString.



  • OK, sorry about that. I was just searching for stuff and did not notice the date :-(.

    Thanks for your advice. I look into the arg() stuff in more detail.


  • Moderators

    Not a problem. Glad to help! If you have further questions, feel free to ask!


Log in to reply
 

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