2、格式化输出
format! 格式化文本并返回結果到字符串
print! 輸出格式化文本到控制臺
println! 輸出格式化文本到控制臺,并在行尾自動加換行
代碼文件,format.rc
fn main() {fn main() {let hello = format!("hello {}", "world");println!("{}", hello);println!("hello {}", "format");println!("hello {0}, this is a good {1},{0}", "format", "boy"); } }編譯
rustc format.rc執行
./format輸出結果
hello world hello format hello format, this is a good boy,format總結
- 上一篇: Git 修改 proxy,解决代理导致的
- 下一篇: Git 使用遇到的各种问题