fnformat_print() {println!("\nFormat print test:");let str1 =format!("Just a test with {}", "format!");println!("{}", str1);println!("{one} is {doing} by {two}", one="Tim", doing="beating", two="Tom");println!("{:?}", (12.0, 55));println!("{:05}", 31);println!("{} of {:b} people know binary, the other do not", 1, 2);println!("Padding num with extra 0 {num:>0width$}", num=12, width=5);}/*Format print test:Just a test with format!Tim is beating by Tom(12.0, 55)000311 of 10 people know binary, the other do notPadding num with extra 0 00012*/
// Hello {arg 0 ("x")} is {arg 1 (0.01) with precision specified inline (5)}println!("Hello {0} is {1:.5}", "x", 0.01);// Hello {arg 1 ("x")} is {arg 2 (0.01) with precision specified in arg 0 (5)}println!("Hello {1} is {2:.0$}", 5, "x", 0.01);// Hello {arg 0 ("x")} is {arg 2 (0.01) with precision specified in arg 1 (5)}println!("Hello {0} is {2:.1$}", "x", 5, 0.01);// Hello {next arg ("x")} is {second of next two args (0.01) with precision// specified in first of next two args (5)}println!("Hello {} is {:.*}", "x", 5, 0.01);// Hello {next arg ("x")} is {arg 2 (0.01) with precision// specified in its predecessor (5)}println!("Hello {} is {2:.*}", "x", 5, 0.01);// Hello {next arg ("x")} is {arg "number" (0.01) with precision specified// in arg "prec" (5)}println!("Hello {} is {number:.prec$}", "x", prec =5, number =0.01);