diff --git a/doc/Text Formatting.html b/doc/Text Formatting.html index 0d4a8d66..e20eae36 100644 --- a/doc/Text Formatting.html +++ b/doc/Text Formatting.html @@ -516,24 +516,24 @@ The meaning of the various alignment options is as follows: -'<' +'<' Forces the field to be left-aligned within the available space (this is the default for most objects). -'>' +'>' Forces the field to be right-aligned within the available space (this is the default for numbers). -'=' +'=' Forces the padding to be placed after the sign (if any) but before the digits. This is used for printing fields in the form +000000120. This alignment option is only valid for numeric types. -'^' +'^' Forces the field to be centered within the available space. @@ -556,12 +556,12 @@ the following: -'+' +'+' Indicates that a sign should be used for both positive as well as negative numbers. -'-' +'-' Indicates that a sign should be used only for negative numbers (this is the default behavior). @@ -573,7 +573,223 @@ the following: -

TODO

+

+The '#' option causes the alternate form"0b" ("0B"), "0", or +"0x" ("0X") to the output value. Whether the prefix +is lower-case or upper-case is determined by the case of the type specifier, +for example, the prefix "0x" is used for the type 'x' +and "0X" is used for 'X'. For floating-point numbers +the alternate form causes the result of the conversion to always contain a +decimal-point character, even if no digits follow it. Normally, a decimal-point +character appears in the result of these conversions only if a digit follows it. +In addition, for 'g' and 'G' conversions, trailing +zeros are not removed from the result. +

+ +

+width is a decimal integer defining the minimum field width. If +not specified, then the field width will be determined by the content. +

+ +

+Preceding the width field by a zero ('0') character +enables sign-aware zero-padding for numeric types. This is equivalent to a +fill character of '0' with an alignment +type of '='. +

+ +

+The precision is a decimal number indicating how many digits should +be displayed after the decimal point for a floating-point value formatted with +'f' and 'F', or before and after the decimal point +for a floating-point value formatted with 'g' or 'G'. +For non-number types the field indicates the maximum field size - in other +words, how many characters will be used from the field content. The +precision is not allowed for integer, character, Boolean, and +pointer values. +

+ +

+Finally, the type determines how the data should be presented. +

+ +

The available string presentation types are:

+ + + + + + + + + + + + + + + +
TypeMeaning
's'String format. This is the default type for strings and may be omitted.
noneThe same as 's'.
+ +

The available character presentation types are:

+ + + + + + + + + + + + + + + +
TypeMeaning
'c'Character format. This is the default type for characters and may be + omitted.
noneThe same as 'c'.
+ +

The available integer presentation types are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeMeaning
'b'Binary format. Outputs the number in base 2. Using the '#' + option with this type adds the prefix "0b" to the output + value.
'B'Binary format. Outputs the number in base 2. Using the '#' + option with this type adds the prefix "0B" to the output + value.
'd'Decimal integer. Outputs the number in base 10.
'o'Octal format. Outputs the number in base 8.
'x'Hex format. Outputs the number in base 16, using lower-case letters for the + digits above 9. Using the '#' option with this type adds the + prefix "0x" to the output value.
'X'Hex format. Outputs the number in base 16, using upper-case letters for the + digits above 9. Using the '#' option with this type adds the + prefix "0X" to the output value.
'n'Number. This is the same as 'd', except that it uses the + current locale setting to insert the appropriate number separator + characters.
noneThe same as 'd'.
+ +

+Integer presentation types can also be used with character and Boolean values. +Boolean values are formatted using textual representation, either true or false, +if the presentation type is not specified. +

+ +

The available presentation types for floating-point values are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeMeaning
'a'Hexadecimal floating point format. Prints the number in base 16 with prefix + "0x" and lower-case letters for digits above 9. Uses + 'p' to indicate the exponent.
'A'Same as 'a' except it uses upper-case letters for the prefix, + digits above 9 and to indicate the exponent.
'e'Exponent notation. Prints the number in scientific notation using the + letter 'e' to indicate the exponent.
'E'Exponent notation. Same as 'e' except it uses an upper-case + 'E' as the separator character.
'f'Fixed point. Displays the number as a fixed-point number.
'F'Fixed point. Same as 'f', but converts nan to + NAN and inf to INF.
'g'General format. For a given precision p >= 1, this rounds the + number to p significant digits and then formats the result in + either fixed-point format or in scientific notation, depending on its + magnitude. + + A precision of 0 is treated as equivalent to a precision of + 1.
'n'Number. This is the same as 'g', except that it uses the + current locale setting to insert the appropriate number separator + characters.
noneThe same as 'g'.
+ +

The available presentation types for pointers are:

+ + + + + + + + + + + + + + + +
TypeMeaning
'p'Pointer format. This is the default type for pointers and may be + omitted.
noneThe same as 'p'.

Class format_error