Skip to content

Latest commit

 

History

History
12 lines (8 loc) · 403 Bytes

format-string-output.md

File metadata and controls

12 lines (8 loc) · 403 Bytes

Format string output

When displaying a string, format the output with arguments.

In this example, each number will have at least a width of two characters. If necessary, a zero will be prepended.

// Where hours, minutes are of type i32
write!(f, "{:02}:{:02}", hours, minutes)

See width arguments.