Format () Basic syntax:
???? {index [, align] [: format string]}
????· Index: Represents the nth object parameter in a list of referenced objects.
????· Align (optional): Sets the width and alignment, which is a signed integer. Positive numbers are right-aligned, and negative numbers are left-aligned. For example: {0,50} indicates a width of 50, right-justified. {0,-50} indicates a width of 50, left-justified.
????· Format strings: Common "data Format", "Date and Time format", custom format, etc. Start with "Colon". For example: Number format:C for Currency , D for decimal number, E for scientific notation, G for general 、.... which can be written as cxx,xx for precision, with a range of 0-99, such as String. The C3 in Fromat ("=={0,30:c3}==", 3.1415926535384) indicates that 3 decimal places are reserved. DateTime format: D for short date, d for long date, F for full date + short time, F for full date + long time, T for short time mode 、.....
As shown in the following:
????
If you want to keep several decimals in a single, as shown:
String. Format () string formatting