Skip to content

Format-Table (and Format-List) should have a -FormatString parameter.  #17544

@jhoneill

Description

@jhoneill

Summary of the new feature / enhancement

Sending some data through format table I see this

Product         Birmingham          Cardiff        Edinburgh          Glasgow           London
-------         ----------          -------        ---------          -------           ------
Asparagus             26.5               26 26.6666666666667 28.1666666666667 27.3333333333333
Cucumber  27.6666666666667 27.3333333333333             33.5 21.1666666666667 28.3333333333333
Lettuce   29.6666666666667             23.5 35.1666666666667 25.1666666666667 35.1666666666667
Potato                21.5 26.1666666666667 24.3333333333333             24.5               30
Tomato    32.3333333333333               32 28.8333333333333 29.1666666666667             26.5

Using custom properties I can specify a format string for each column. But that needs to be done 5 times - and may places of decimals limit the number of columns that can be fitted in.

In an ideal world we would have <blah> | format-table * -FormatString "0.00"

Proposed technical implementation details (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions