This shows you the differences between two versions of the page.
en:public:developer:template_system:tags:parameters:format [2012/11/25 14:01] admin [Format] |
en:public:developer:template_system:tags:parameters:format [2016/04/07 17:18] (current) svanderclock |
||
---|---|---|---|
Line 5: | Line 5: | ||
the value is manipulated into the returned string. | the value is manipulated into the returned string. | ||
+ | **NOTE:** By default the resulting content and the content of the parameter "Format", "DecimalSeparator", | ||
+ | "ThousandSeparator" will be parsed (all <#..> tags will be evaluated) before to apply this filter. | ||
+ | You can control this behavior throught the parameter | ||
+ | [[en:public:developer:template_system:tags:parameters:AnalyzeTagParams]] | ||
+ | |||
The Formatting string can comprise a mix of ordinary characters (that are passed unchanged | The Formatting string can comprise a mix of ordinary characters (that are passed unchanged | ||
to the result string), and data formatting characters. This formatting is best | to the result string), and data formatting characters. This formatting is best | ||
Line 10: | Line 15: | ||
of the following : | of the following : | ||
+ | | <html><span style="color:#008000"><nobr><b>%</b><b>b</b></nobr></span></html> | Boolean | The argument must be an integer or boolean value. The value is converted to a boolean string using the [[en:public:developer:template_system:tags:parameters:TrueStr]] and [[en:public:developer:template_system:tags:parameters:FalseStr]] params. | | ||
| <html><span style="color:#008000"><nobr><b>%</b><span style="color:blue">[-][width][.prec]</span><b>d</b></nobr></span></html> | Decimal | The argument must be an integer value. The value is converted to a string of decimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has less digits, the resulting string is left-padded with zeros. A width specifier sets the minimum field width for a conversion. If the resulting string is shorter than the minimum field width, it is padded with blanks to increase the field width. The default is to right-justify the result by adding blanks in front of the value, but if the format specifier contains a left-justification indicator (an "-" en dash character preceding the width specifier), the result is left-justified by adding blanks after the value.| | | <html><span style="color:#008000"><nobr><b>%</b><span style="color:blue">[-][width][.prec]</span><b>d</b></nobr></span></html> | Decimal | The argument must be an integer value. The value is converted to a string of decimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has less digits, the resulting string is left-padded with zeros. A width specifier sets the minimum field width for a conversion. If the resulting string is shorter than the minimum field width, it is padded with blanks to increase the field width. The default is to right-justify the result by adding blanks in front of the value, but if the format specifier contains a left-justification indicator (an "-" en dash character preceding the width specifier), the result is left-justified by adding blanks after the value.| | ||
| <html><span style="color:#008000"><nobr><b>%</b><span style="color:blue">[-][width][.prec]</span><b>u</b></nobr></span></html> | Unsigned decimal | Similar to d, but no sign is output. A width specifier sets the minimum field width for a conversion. If the resulting string is shorter than the minimum field width, it is padded with blanks to increase the field width. The default is to right-justify the result by adding blanks in front of the value, but if the format specifier contains a left-justification indicator (an "-" en dash character preceding the width specifier), the result is left-justified by adding blanks after the value.| | | <html><span style="color:#008000"><nobr><b>%</b><span style="color:blue">[-][width][.prec]</span><b>u</b></nobr></span></html> | Unsigned decimal | Similar to d, but no sign is output. A width specifier sets the minimum field width for a conversion. If the resulting string is shorter than the minimum field width, it is padded with blanks to increase the field width. The default is to right-justify the result by adding blanks in front of the value, but if the format specifier contains a left-justification indicator (an "-" en dash character preceding the width specifier), the result is left-justified by adding blanks after the value.| | ||
Line 104: | Line 110: | ||
format given by the LongTimeFormat parameter. The time is not displayed if | format given by the LongTimeFormat parameter. The time is not displayed if | ||
the date-time value indicates midnight precisely.</td> | the date-time value indicates midnight precisely.</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>f</td> | ||
+ | <td>Displays the date as a float number.</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
Line 234: | Line 244: | ||
<code> | <code> | ||
- | <#Var name="MyVar" value="-123"> | + | <#MyVar setValue="-123"> |
<#MyVar Format="'Decimal = '%.5d"> | <#MyVar Format="'Decimal = '%.5d"> | ||
- | <#Var name="MyVar" value="123"> | + | <#MyVar setValue="123"> |
<#MyVar Format="'Unsigned decimal = '%u"> | <#MyVar Format="'Unsigned decimal = '%u"> | ||
- | <#Var name="MyVar" value="12345.678"> | + | <#MyVar setValue="12345.678"> |
<#MyVar Format="'Exponent = '%e"> | <#MyVar Format="'Exponent = '%e"> | ||
- | <#Var name="MyVar" value="12345.678"> | + | <#MyVar setValue="12345.678"> |
<#MyVar Format="'Fixed = '%.2f"> | <#MyVar Format="'Fixed = '%.2f"> | ||
- | <#Var name="MyVar" value="12345.0001"> | + | <#MyVar setValue="12345.0001"> |
<#MyVar Format="'General = '%g"> | <#MyVar Format="'General = '%g"> | ||
- | <#Var name="MyVar" value="12345.678872"> | + | <#MyVar setValue="12345.678872"> |
<#MyVar Format="'Number = '%.3n"> | <#MyVar Format="'Number = '%.3n"> | ||
- | <#Var name="MyVar" value="12345.678"> | + | <#MyVar setValue="12345.678"> |
<#MyVar Format="'Money = '%.2m"> | <#MyVar Format="'Money = '%.2m"> | ||
- | <#Var name="MyVar" value="Hello"> | + | <#MyVar setValue="Hello"> |
<#MyVar Format="'String = '%s"> | <#MyVar Format="'String = '%s"> | ||
- | <#Var name="MyVar" value="140"> | + | <#MyVar setValue="140"> |
<#MyVar Format="'Hexadecimal = '%x"> | <#MyVar Format="'Hexadecimal = '%x"> | ||
- | <#Var name="MyVar" value="12345.678"> | + | <#MyVar setValue="12345.678"> |
<#MyVar Format="'Float = '%0.##"> | <#MyVar Format="'Float = '%0.##"> | ||
- | <#Var name="MyVar" value="NOW"> | + | <#MyVar setValue="NOW"> |
<#MyVar Format="'Date = 'mm/dd/yyyy"> | <#MyVar Format="'Date = 'mm/dd/yyyy"> | ||