User Tools

Site Tools


en:public:developer:template_system:tags:parameters:format

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:public:developer:template_system:tags:parameters:format [2013/01/27 18:43]
admin
en:public:developer:template_system:tags:parameters:format [2016/04/07 17:18] (current)
svanderclock
Line 4: Line 4:
 It provides very precise control over this formatting. The Formatting parameter defines how  It provides very precise control over this formatting. The Formatting parameter defines how 
 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",  **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.  "ThousandSeparator" will be parsed (all <#..> tags will be evaluated) before to apply this filter. 
 You can control this behavior throught the parameter  You can control this behavior throught the parameter 
 [[en:public:developer:template_system:tags:parameters:AnalyzeTagParams]] [[en:public:developer:template_system:tags:parameters:AnalyzeTagParams]]
-  
-Data formatting characters must be one of the following :  
  
 +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 
 +explained by the example code. Ordinary characters must be quoted and data formatting characters must be one
 +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 106: 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 237: Line 245:
  
 <#MyVar setValue="-123"> <#MyVar setValue="-123">
-Decimal = <#MyVar Format="%.5d">+<#MyVar Format="'Decimal = '%.5d">
  
 <#MyVar setValue="123"> <#MyVar setValue="123">
-Unsigned decimal = <#MyVar Format="%u">+<#MyVar Format="'Unsigned decimal = '%u">
  
 <#MyVar setValue="12345.678"> <#MyVar setValue="12345.678">
-Exponent = <#MyVar Format="%e">+<#MyVar Format="'Exponent = '%e">
  
 <#MyVar setValue="12345.678"> <#MyVar setValue="12345.678">
-Fixed = <#MyVar Format="%.2f">+<#MyVar Format="'Fixed = '%.2f">
  
 <#MyVar setValue="12345.0001"> <#MyVar setValue="12345.0001">
-General = <#MyVar Format="%g">+<#MyVar Format="'General = '%g">
  
 <#MyVar setValue="12345.678872"> <#MyVar setValue="12345.678872">
-Number = <#MyVar Format="%.3n">+<#MyVar Format="'Number = '%.3n">
  
 <#MyVar setValue="12345.678"> <#MyVar setValue="12345.678">
-Money = <#MyVar Format="%.2m">+<#MyVar Format="'Money = '%.2m">
  
 <#MyVar setValue="Hello"> <#MyVar setValue="Hello">
-String = <#MyVar Format="%s">+<#MyVar Format="'String = '%s">
  
 <#MyVar setValue="140"> <#MyVar setValue="140">
-Hexadecimal = <#MyVar Format="%x">+<#MyVar Format="'Hexadecimal = '%x">
  
 <#MyVar setValue="12345.678"> <#MyVar setValue="12345.678">
-Float = <#MyVar Format="%0.##">+<#MyVar Format="'Float = '%0.##">
  
 <#MyVar setValue="NOW"> <#MyVar setValue="NOW">
-Date = <#MyVar Format="mm/dd/yyyy">+<#MyVar Format="'Date = 'mm/dd/yyyy">
  
 </code> </code>
en/public/developer/template_system/tags/parameters/format.1359297823.txt.gz ยท Last modified: 2013/01/27 18:43 by admin