官术网_书友最值得收藏!

  • Learning Rust
  • Paul Johnson Vesa Kaihlavirta
  • 81字
  • 2021-07-02 23:07:21

Controlling the output formatting

The std::fmt module provides the developer with a range of utilities for formatting and printing strings. Let's start with the format! macro. This macro returns a string.

We have seen that if we use println!(Hello {}, myString), the code will print the contents of myString after the Hello. The format! macro works pretty much the same, just that it returns the formatted string instead of outputting it. In fact, println! essentially uses format! itself under the hood.

主站蜘蛛池模板: 麻栗坡县| 焦作市| 加查县| 曲松县| 陈巴尔虎旗| 高雄市| 富阳市| 淮南市| 闵行区| 甘南县| 长垣县| 汝城县| 康马县| 陆川县| 南宁市| 枝江市| 济南市| 嘉祥县| 定陶县| 勃利县| 泊头市| 陇南市| 万宁市| 唐河县| 雅江县| 汕头市| 绥化市| 双柏县| 江陵县| 南开区| 建始县| 正定县| 池州市| 宁强县| 禹州市| 金塔县| 福州市| 泸定县| 乌兰浩特市| 班戈县| 霍城县|