goog.format
Namespacegoog.format.EmailAddress
ClassFormats an email address string for display, and allows for extraction of The individual componants of the address. … more
goog.format.HtmlPrettyPrinter
ClassThis class formats HTML to be more human-readable. TODO(user): Add hierarchical indentation. … more
goog.format.JsonPrettyPrinter
ClassFormats a JSON object as a string, properly indented for display. Supports
displaying the string as text or html. Users can also specify their own
set of delimiters for different environments. For example, the JSON object:
{"a": 1, "b": {"c": null, "d": true, "e": [1, 2]}}
Will be displayed like this:
{
"a": 1,
"b": {
"c": null,
"d": true,
"e": [
1,
2
]
}
}
… more
.WORD_BREAK_HTML
{string
}Constant for the WBR replacement used by insertWordBreaks. Safari requires
Formats a number of bytes in human readable form.
54, 450K, 1.3M, 5G etc.
Inserts word breaks into an HTML string at a given interval.
This method is as aggressive as possible, using a full table of Unicode
characters where it is legal to insert word breaks; however, this table
comes at a 2.5k pre-gzip (~1k post-gzip) size cost. Consider using
insertWordBreaksBasic to minimize the size impact.
Inserts word breaks into an HTML string at a given interval.
This method is less aggressive than insertWordBreaks, only inserting
breaks next to punctuation and between Latin or Cyrillic characters.
However, this is good enough for the common case of URLs. It also
works for all Latin and Cyrillic languages, plus CJK has no need for word
breaks. When this method is used, goog.i18n.GraphemeBreak may be dead
code eliminated.
Checks whether string value containing scaling units (K, M, G, T, P, m,
u, n) can be converted to a number.
Where there is a decimal, there must be a digit to the left of the
decimal point.
Negative numbers are valid.
Examples:
0, 1, 1.0, 10.4K, 2.3M, -0.3P, 1.2m
Converts number of bytes to string representation. Binary conversion.
Default is to return the additional 'B' suffix, e.g. '10.5KB' to minimize
confusion with counts that are scaled by powers of 1000.
Converts a numeric value to string representation. SI conversion.
Converts a string to number of bytes, taking into account the units.
Binary conversion.
Converts a string to numeric value, taking into account the units.
If string ends in 'B', use binary conversion.
.fileSize(bytes, opt_decimals)
bytes
{number
}
opt_decimals
{number
=}
string
}
.insertWordBreaks(str, opt_maxlen)
str
{string
}
opt_maxlen
{number
=}
string
}
.insertWordBreaksBasic(str, opt_maxlen)
str
{string
}
opt_maxlen
{number
=}
string
}
.isConvertableScaledNumber(val)
val
{string
}
boolean
}
.numBytesToString(val, opt_decimals, opt_suffix)
val
{number
}
opt_decimals
{number
=}
opt_suffix
{boolean
=}
string
}
.numericValueToString(val, opt_decimals)
val
{number
}
opt_decimals
{number
=}
string
}
.stringToNumBytes(stringValue)
stringValue
{string
}
number
}
.stringToNumericValue(stringValue)
stringValue
{string
}
number
}