stringformat.js
Implementation of sprintf-like, python-%-operator-like, .NET-String.Format-like functionality. Uses JS string's replace method to extract format specifiers and sends those specifiers to a handler function, which then, based on conversion type part of the specifier, calls the appropriate function to handle the specific conversion. For specific functionality implemented, look at formatRe below, or look at the tests.

File Location

string/stringformat.js


Show:

Global Functions

goog.string.format(formatStringvar_args)
Performs sprintf-like conversion, ie. puts the values in a template. DO NOT use it instead of built-in conversions in simple cases such as 'Cost: %.2f' as it would introduce unneccessary latency oposed to 'Cost: ' + cost.toFixed(2).
Arguments:
formatString :
Template string containing % specifiers.
var_args :
Values formatString is to be filled with.
Returns:   Formatted string.
code »
1 hidden public item.

Global Properties

goog.string.format.demuxes_ :
Contains various conversion functions (to be filled in later on).
Code »
1 hidden private item.

Directory string

File Reference