-<!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-util.Format'>/**
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>The source code</title>
+ <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
+ <script type="text/javascript" src="../prettify/prettify.js"></script>
+ <style type="text/css">
+ .highlight { display: block; background-color: #ddd; }
+ </style>
+ <script type="text/javascript">
+ function highlight() {
+ document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
+ }
+ </script>
+</head>
+<body onload="prettyPrint(); highlight();">
+ <pre class="prettyprint lang-js"><span id='Ext-util-Format'>/**
</span> * @class Ext.util.Format
This class is a centralized place for formatting functions inside the library. It includes
I18NFormatCleanRe;
Ext.apply(UtilFormat, {
-<span id='Ext-util.Format-property-thousandSeparator'> /**
+<span id='Ext-util-Format-property-thousandSeparator'> /**
</span> * @type String
* @property thousandSeparator
* <p>The character that the {@link #number} function uses as a thousand separator.</p>
*/
thousandSeparator: ',',
-<span id='Ext-util.Format-property-decimalSeparator'> /**
+<span id='Ext-util-Format-property-decimalSeparator'> /**
</span> * @type String
* @property decimalSeparator
* <p>The character that the {@link #number} function uses as a decimal point.</p>
*/
decimalSeparator: '.',
-<span id='Ext-util.Format-property-currencyPrecision'> /**
+<span id='Ext-util-Format-property-currencyPrecision'> /**
</span> * @type Number
* @property currencyPrecision
* <p>The number of decimal places that the {@link #currency} function displays.</p>
*/
currencyPrecision: 2,
-<span id='Ext-util.Format-property-currencySign'> /**
+<span id='Ext-util-Format-property-currencySign'> /**
</span> * @type String
* @property currencySign
* <p>The currency sign that the {@link #currency} function displays.</p>
*/
currencySign: '$',
-<span id='Ext-util.Format-property-currencyAtEnd'> /**
+<span id='Ext-util-Format-property-currencyAtEnd'> /**
</span> * @type Boolean
* @property currencyAtEnd
* <p>This may be set to <code>true</code> to make the {@link #currency} function
*/
currencyAtEnd: false,
-<span id='Ext-util.Format-method-undef'> /**
+<span id='Ext-util-Format-method-undef'> /**
</span> * Checks a reference and converts it to empty string if it is undefined
* @param {Mixed} value Reference to check
* @return {Mixed} Empty string if converted, otherwise the original value
return value !== undefined ? value : "";
},
-<span id='Ext-util.Format-method-defaultValue'> /**
+<span id='Ext-util-Format-method-defaultValue'> /**
</span> * Checks a reference and converts it to the default value if it's empty
* @param {Mixed} value Reference to check
* @param {String} defaultValue The value to insert of it's undefined (defaults to "")
return value !== undefined && value !== '' ? value : defaultValue;
},
-<span id='Ext-util.Format-method-substr'> /**
+<span id='Ext-util-Format-method-substr'> /**
</span> * Returns a substring from within an original string
* @param {String} value The original text
* @param {Number} start The start index of the substring
return String(value).substr(start, length);
},
-<span id='Ext-util.Format-method-lowercase'> /**
+<span id='Ext-util-Format-method-lowercase'> /**
</span> * Converts a string to all lower case letters
* @param {String} value The text to convert
* @return {String} The converted text
return String(value).toLowerCase();
},
-<span id='Ext-util.Format-method-uppercase'> /**
+<span id='Ext-util-Format-method-uppercase'> /**
</span> * Converts a string to all upper case letters
* @param {String} value The text to convert
* @return {String} The converted text
return String(value).toUpperCase();
},
-<span id='Ext-util.Format-method-usMoney'> /**
+<span id='Ext-util-Format-method-usMoney'> /**
</span> * Format a number as US currency
* @param {Number/String} value The numeric value to format
* @return {String} The formatted currency string
return UtilFormat.currency(v, '$', 2);
},
-<span id='Ext-util.Format-method-currency'> /**
+<span id='Ext-util-Format-method-currency'> /**
</span> * Format a number as a currency
* @param {Number/String} value The numeric value to format
* @param {String} sign The currency sign to use (defaults to {@link #currencySign})
}
},
-<span id='Ext-util.Format-method-date'> /**
+<span id='Ext-util-Format-method-date'> /**
</span> * Formats the passed date using the specified format pattern.
* @param {String/Date} value The value to format. If a string is passed, it is converted to a Date by the Javascript
* Date object's <a href="http://www.w3schools.com/jsref/jsref_parse.asp">parse()</a> method.
return Ext.Date.dateFormat(v, format || Ext.Date.defaultFormat);
},
-<span id='Ext-util.Format-method-dateRenderer'> /**
+<span id='Ext-util-Format-method-dateRenderer'> /**
</span> * Returns a date rendering function that can be reused to apply a date format multiple times efficiently
* @param {String} format Any valid date format string. Defaults to {@link Ext.Date#defaultFormat}.
* @return {Function} The date formatting function
};
},
-<span id='Ext-util.Format-method-stripTags'> /**
+<span id='Ext-util-Format-method-stripTags'> /**
</span> * Strips all HTML tags
* @param {Mixed} value The text from which to strip tags
* @return {String} The stripped text
return !v ? v : String(v).replace(stripTagsRE, "");
},
-<span id='Ext-util.Format-method-stripScripts'> /**
+<span id='Ext-util-Format-method-stripScripts'> /**
</span> * Strips all script tags
* @param {Mixed} value The text from which to strip script tags
* @return {String} The stripped text
return !v ? v : String(v).replace(stripScriptsRe, "");
},
-<span id='Ext-util.Format-method-fileSize'> /**
+<span id='Ext-util-Format-method-fileSize'> /**
</span> * Simple format for a file size (xxx bytes, xxx KB, xxx MB)
* @param {Number/String} size The numeric value to format
* @return {String} The formatted file size
}
},
-<span id='Ext-util.Format-method-math'> /**
+<span id='Ext-util-Format-method-math'> /**
</span> * It does simple math for use in a template, for example:<pre><code>
* var tpl = new Ext.Template('{value} * 10 = {value:math("* 10")}');
* </code></pre>
* @return {Function} A function that operates on the passed value.
+ * @method
*/
math : function(){
var fns = {};
};
}(),
-<span id='Ext-util.Format-method-round'> /**
+<span id='Ext-util-Format-method-round'> /**
</span> * Rounds the passed number to the required decimal precision.
* @param {Number/String} value The numeric value to round.
* @param {Number} precision The number of decimal places to which to round the first parameter's value.
return result;
},
-<span id='Ext-util.Format-method-number'> /**
+<span id='Ext-util-Format-method-number'> /**
</span> * <p>Formats the passed number according to the passed format string.</p>
* <p>The number of digits after the decimal separator character specifies the number of
* decimal places in the resulting string. The <u>local-specific</u> decimal character is used in the result.</p>
return (neg ? '-' : '') + formatString.replace(/[\d,?\.?]+/, fnum);
},
-<span id='Ext-util.Format-method-numberRenderer'> /**
+<span id='Ext-util-Format-method-numberRenderer'> /**
</span> * Returns a number rendering function that can be reused to apply a number format multiple times efficiently
* @param {String} format Any valid number format string for {@link #number}
* @return {Function} The number formatting function
};
},
-<span id='Ext-util.Format-method-plural'> /**
+<span id='Ext-util-Format-method-plural'> /**
</span> * Selectively do a plural form of a word based on a numeric value. For example, in a template,
* {commentCount:plural("Comment")} would result in "1 Comment" if commentCount was 1 or would be "x Comments"
* if the value is 0 or greater than 1.
return v +' ' + (v == 1 ? s : (p ? p : s+'s'));
},
-<span id='Ext-util.Format-method-nl2br'> /**
+<span id='Ext-util-Format-method-nl2br'> /**
</span> * Converts newline characters to the HTML tag &lt;br/>
* @param {String} The string value to format.
* @return {String} The string with embedded &lt;br/> tags in place of newlines.
return Ext.isEmpty(v) ? '' : v.replace(nl2brRe, '<br/>');
},
-<span id='Ext-util.Format-property-capitalize'> /**
+<span id='Ext-util-Format-method-capitalize'> /**
</span> * Capitalize the given string. See {@link Ext.String#capitalize}.
+ * @method
*/
capitalize: Ext.String.capitalize,
-<span id='Ext-util.Format-property-ellipsis'> /**
+<span id='Ext-util-Format-method-ellipsis'> /**
</span> * Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length.
* See {@link Ext.String#ellipsis}.
+ * @method
*/
ellipsis: Ext.String.ellipsis,
-<span id='Ext-util.Format-property-format'> /**
+<span id='Ext-util-Format-method-format'> /**
</span> * Formats to a string. See {@link Ext.String#format}
+ * @method
*/
format: Ext.String.format,
-<span id='Ext-util.Format-property-htmlDecode'> /**
+<span id='Ext-util-Format-method-htmlDecode'> /**
</span> * Convert certain characters (&, <, >, and ') from their HTML character equivalents.
* See {@link Ext.string#htmlDecode}.
+ * @method
*/
htmlDecode: Ext.String.htmlDecode,
-<span id='Ext-util.Format-property-htmlEncode'> /**
+<span id='Ext-util-Format-method-htmlEncode'> /**
</span> * Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.
* See {@link Ext.String#htmlEncode}.
+ * @method
*/
htmlEncode: Ext.String.htmlEncode,
-<span id='Ext-util.Format-property-leftPad'> /**
+<span id='Ext-util-Format-method-leftPad'> /**
</span> * Adds left padding to a string. See {@link Ext.String#leftPad}
+ * @method
*/
leftPad: Ext.String.leftPad,
-<span id='Ext-util.Format-property-trim'> /**
+<span id='Ext-util-Format-method-trim'> /**
</span> * Trims any whitespace from either side of a string. See {@link Ext.String#trim}.
+ * @method
*/
trim : Ext.String.trim,
-<span id='Ext-util.Format-method-parseBox'> /**
+<span id='Ext-util-Format-method-parseBox'> /**
</span> * Parses a number or string representing margin sizes into an object. Supports CSS-style margin declarations
* (e.g. 10, "10", "10 10", "10 10 10" and "10 10 10 10" are all valid options and would return the same result)
* @param {Number|String} v The encoded margins
};
},
-<span id='Ext-util.Format-method-escapeRegex'> /**
+<span id='Ext-util-Format-method-escapeRegex'> /**
</span> * Escapes the passed string for use in a regular expression
* @param {String} str
* @return {String}
}
});
})();
-</pre></pre></body></html>
\ No newline at end of file
+</pre>
+</body>
+</html>