2、格式化输出
format! 格式化文本并返回結(jié)果到字符串
print! 輸出格式化文本到控制臺(tái)
println! 輸出格式化文本到控制臺(tái),并在行尾自動(dòng)加換行
代碼文件,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執(zhí)行
./format輸出結(jié)果
hello world hello format hello format, this is a good boy,format總結(jié)
- 上一篇: Git 修改 proxy,解决代理导致的
- 下一篇: Git 使用遇到的各种问题