Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions 07-type/07-04-operator-and-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ format!("{:?}", "Hello");

另外请记住:type这个地方为空的话默认调用的是`Display`这个trait。

还有两个比较有用的type是`e`和`E`。他们分别是小写字母和大写字母格式化,别在苦逼兮兮的写大小写转换函数了,Rust早帮你设计好了。

关于`:`号后面的东西其实还有更多式子,我们从上面的`{0:>0width$}`来分析它。

首先`>`是一个语义,它表示的是生成的字符串向右对齐,于是我们得到了 `0081`这个值。与之相对的还有`<`(向左对齐)和`^`(居中)。
Expand Down