File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -304,6 +304,28 @@ cout << format("%s %d") % "price" % 1234;
304
304
// price 1234
305
305
</source>
306
306
307
+ <h4>fmt</h4>
308
+
309
+ Home:[https://github.com/fmtlib/fmt]
310
+
311
+ 这是一个轻量级、类型安全、高性能的字符串格式化库。它也可以用来替代 C++ 标准库中的 IOStreams。
312
+
313
+ 代码示例
314
+ <source lang="cpp">
315
+ #include <string>
316
+ #include <fmt/format.h>
317
+
318
+ // 使用 Python 的格式化语法
319
+ fmt::print("Hello, {}!", "world");
320
+ // 使用 printf 的格式化语法
321
+ fmt::printf("Hello, %s!", "world");
322
+ // 使用序号参数,
323
+ std::string s = fmt::format("{0} {1} {0}", "Hello", "world");
324
+ // 使用命名参数
325
+ fmt::print("Hello, {name}! The answer is {number}. Goodbye, {name}.",
326
+ fmt::arg("name", "World"), fmt::arg("number", 42));
327
+ </source>
328
+
307
329
=== 2.3.3 正则表达式 ===
308
330
309
331
<h4>PCRE(Perl Compatible Regular Expressions)</h4>
You can’t perform that action at this time.
0 commit comments