How to format a QString?

前端 未结 3 873
眼角桃花
眼角桃花 2021-01-31 01:07

I\'d like to format a string for Qt label, I\'m programming in C++ on Qt.

In ObjC I would write something like:

NSString *format=[NSString stringWithFor         


        
3条回答
  •  独厮守ぢ
    2021-01-31 01:40

    You can use the sprintf method, however the arg method is preferred as it supports unicode.

    QString str;
    str.sprintf("%s %d", "string", 213);
    

提交回复
热议问题