File: README.txt

Recommend this page to a friend!
  Classes of Sergio Flores Genis  >  JavaScript String Format  >  README.txt  >  Download  
File: README.txt
Role: Documentation
Content type: text/markdown
Description: Syntax Explanation
Class: JavaScript String Format
Format text string according to a pattern
Author: By
Last change: The table is not displayed correctly
Date: 5 years ago
Size: 1,584 bytes


Class file image Download


Each function call requires a format string and a list of arguments. The format string can be a fixed text string or one or more inlays that specify the format. Format specifiers begin and end in braces {...}. The general format for formatting strings or numbers is:

  • argument_index: (required) is the unsigned integer indicating the index of the argument to take from the list. The index is numbered from zero to n (0, 1, 2, 3 ... n).
  • align: (optional) character - (minus) indicates that the text is aligned to the left.
  • char: (optional) a character with the apostrophe prefix, fill in the result when the width indicated.
  • width: (optional) is the unsigned integer indicating the filling result.
  • conversion: (required if) Conversion argument to be formatted. "s" used to string and default if not indicated. "n" used to format numbers.
  • arguments: see below.
  • object_property: if the argument is an object that allows him to read a property. The point separates sub properties.

Arguments for numbers (n)

The following table shows the supported arguments.

| Flag | Description | |------|-------------------------------------------------------------| | + | The result will always include a sign | | # | The result will include a leading space for positive values | | , | The result will include locale-specific grouping separators |