idealvin / coost

A tiny boost library in C++11.
Other
4.01k stars 563 forks source link

fastring add a formatting function. #186

Closed 1647606255 closed 3 years ago

1647606255 commented 3 years ago

fastring add a fomatting function.

1647606255 commented 3 years ago

Example: QString QString().sprintf(...) look like as printf() . number:QString::number(number, ‘f’, 3); string:QString s=QString("username=%s,pw=%s").arg("Anson").agr("123456")

Example:CString CString str;   double num=1.46;   str.Format(_T("%lf"),num); str.Format(_T("%s"),"test");

Example:java String str=null; str=String.format("Hi,%s", "王力"); System.out.println(str); str=String.format("Hi,%s:%s.%s", "王南","王力","王张");

idealvin commented 3 years ago

I'm not to add a format, instead, I provide a cat.

fastring s = str::cat("Hi,", "kakalot", ':', 123);
s.cat(false, " nice ", 3.14);