Skip to content

Improve escape sequences support in *printf(...) #31

Open
@scopeInfinity

Description

@scopeInfinity

Source

Specification

Source: https://en.wikipedia.org/wiki/Printf_format_string#Format_placeholder_specification

  • syntax for a format placeholder: %[parameter][flags][width][.precision][length]type

To keep things simple we can go with the subset of the following options to build an minimum viable product

  • Type field:
    • '%'
    • 'd' 'i'
    • 'u'
    • 'f' 'F'
    • 'g' 'G'
    • 'x' 'X'
    • 'o'
    • 's'
    • 'c'
    • 'p'
  • Length field:
  • Flags field:
    • The field may be omitted (default, current behaviour)
    • '-' minus
    • '+' plus
    • ' ' space
    • '0'
  • Width field:
    • The field may be omitted (default, current behaviour)
    • or a numeric integer value
    • or a dynamic value when passed as another argument when indicated by an asterisk *.
  • Precision field:
    • The field may be omitted (default, current behaviour)
    • or a numeric integer value
    • or a dynamic value when passed as another argument when indicated by an asterisk *.

Multiple small pull requests are way better than one giant one :)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions