# Module stringformat

This module is automatically loaded with the main module.
It allows python like string formatting ("some text %s" % "something"). Also similar to sprintf from C.

## globals:▲

### String::format()

Formats a string replacing formatting specifiers with values provided as arguments
which are formatted according to the specifier.
This is an implementation of python's % operator for strings and is similar to sprintf from C.
Usage:
`resultString = formatString.format(value1, v2, ...);`
Each formatString can contain any number of formatting specifiers which are
replaced with the formated values.
The following describes a format-specifier ([...] are optional):
`%[(key)][flag][sign][min][percision]typeOfValue`

- (key)
  If specified the 1st argument is treated as an object/associative array and the formating values
  are retrieved from that object using the key.
- flag:
  0 Use 0s for padding.
  - Left justify result, padding it with spaces.
  Use spaces for padding.
- sign:
  + Numeric values will contain a +|- infront of the number.
- min:
  l The string will be padded with the padding character until it has a minimum length of l.
- percision:
  .x Where x is the percision for floating point numbers and the lenght for 0 padding for integers.
- typeOfValue:
  d Signed integer decimal.
  i Signed integer decimal.
  b Unsigned binary.
  o Unsigned octal.
  u Unsigned decimal.
  x Unsigned hexidecimal (lowercase).
  X Unsigned hexidecimal (uppercase).
  e Floating point exponential format (lowercase).
  E Floating point exponential format (uppercase).
  f Floating point decimal format.
  F Floating point decimal format.
  c Single character (accepts byte or single character string).
  s String (converts any object using object.toString()).

Examples:
"%02d".format(8) == "08"
"%05.2f".format(1.234) == "01.23"
"123 in binary is: %08b".format(123) == "123 in binary is: 01111011"
* Each parameter is treated as a formating value.

### String::pad(flag,len)

Padds a String with a character to have a minimum length.
flag "-": to padd with " " and left justify the string.
Other: the character to use for padding.
len The minimum length of the resulting string.

### String.prototype.mul(c)

Repeats a string.
c The count how often the string should be repeated.