Check out example codes for "rust repeat character x times". It will help you in understanding the concepts better.

Code Example 1

let formatted_title = format!("{:-^1$}", title, n);

Learn ReactJs, React Native from akashmittal.com