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


Public Protected Private

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 »

Global Properties

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

Directory string

File Reference