Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes the operators that are supported by PowerShell.
Locale: en-US
ms.date: 05/07/2024
ms.date: 09/03/2024
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_operators?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about_Operators
Expand Down Expand Up @@ -395,9 +395,23 @@ automatic variable `$args` is preserved.

### Format operator `-f`

Formats strings by using the format method of string objects. Enter the format
string on the left side of the operator and the objects to be formatted on the
right side of the operator.
Provide access to the .NET composite formatting feature. A composite format
string consists of fixed text intermixed with indexed placeholders, called
_format items_. These format items correspond to the objects in the list.

Each format item takes the following form and consists of the following
components:

`{index[,alignment][:formatString]}`

The matching braces (`{` and `}`) are required.

The formatting operation yields a result string that consists of the original
fixed text intermixed with the string representation of the objects in the
list. For more information, [Composite Formatting][02].

Enter the composite format string on the left side of the operator and the
objects to be formatted on the right side of the operator.

```powershell
"{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi
Expand Down Expand Up @@ -430,9 +444,6 @@ escape them by doubling the curly braces.
foo vs. {0}
```

For more information, see the [String.Format][01] method and
[Composite Formatting][02].

### Index operator `[ ]`

Selects objects from indexed collections, such as arrays and hash tables. Array
Expand Down Expand Up @@ -600,7 +611,6 @@ properties and methods of an object, use the Static parameter of the
- [about_Redirection][18]

<!-- link references -->
[01]: /dotnet/api/system.string.format
[02]: /dotnet/standard/base-types/composite-formatting
[03]: /dotnet/standard/base-types/custom-numeric-format-strings#Specifier0
[04]: /powershell/scripting/learn/glossary#scalar-value
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes the operators that are supported by PowerShell.
Locale: en-US
ms.date: 05/07/2024
ms.date: 09/03/2024
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_operators?view=powershell-7.2&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about_Operators
Expand Down Expand Up @@ -442,9 +442,23 @@ automatic variable `$args` is preserved.

### Format operator `-f`

Formats strings by using the format method of string objects. Enter the format
string on the left side of the operator and the objects to be formatted on the
right side of the operator.
Provide access to the .NET composite formatting feature. A composite format
string consists of fixed text intermixed with indexed placeholders, called
_format items_. These format items correspond to the objects in the list.

Each format item takes the following form and consists of the following
components:

`{index[,alignment][:formatString]}`

The matching braces (`{` and `}`) are required.

The formatting operation yields a result string that consists of the original
fixed text intermixed with the string representation of the objects in the
list. For more information, [Composite Formatting][02].

Enter the composite format string on the left side of the operator and the
objects to be formatted on the right side of the operator.

```powershell
"{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi
Expand Down Expand Up @@ -477,9 +491,6 @@ escape them by doubling the curly braces.
foo vs. {0}
```

For more information, see the [String.Format][01] method and
[Composite Formatting][02].

### Index operator `[ ]`

Selects objects from indexed collections, such as arrays and hash tables. Array
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes the operators that are supported by PowerShell.
Locale: en-US
ms.date: 05/07/2024
ms.date: 09/03/2024
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_operators?view=powershell-7.4&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about_Operators
Expand Down Expand Up @@ -442,9 +442,23 @@ automatic variable `$args` is preserved.

### Format operator `-f`

Formats strings by using the format method of string objects. Enter the format
string on the left side of the operator and the objects to be formatted on the
right side of the operator.
Provide access to the .NET composite formatting feature. A composite format
string consists of fixed text intermixed with indexed placeholders, called
_format items_. These format items correspond to the objects in the list.

Each format item takes the following form and consists of the following
components:

`{index[,alignment][:formatString]}`

The matching braces (`{` and `}`) are required.

The formatting operation yields a result string that consists of the original
fixed text intermixed with the string representation of the objects in the
list. For more information, [Composite Formatting][02].

Enter the composite format string on the left side of the operator and the
objects to be formatted on the right side of the operator.

```powershell
"{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi
Expand Down Expand Up @@ -477,9 +491,6 @@ escape them by doubling the curly braces.
foo vs. {0}
```

For more information, see the [String.Format][01] method and
[Composite Formatting][02].

### Index operator `[ ]`

Selects objects from indexed collections, such as arrays and hash tables. Array
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes the operators that are supported by PowerShell.
Locale: en-US
ms.date: 05/07/2024
ms.date: 09/03/2024
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_operators?view=powershell-7.5&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about_Operators
Expand Down Expand Up @@ -442,9 +442,23 @@ automatic variable `$args` is preserved.

### Format operator `-f`

Formats strings by using the format method of string objects. Enter the format
string on the left side of the operator and the objects to be formatted on the
right side of the operator.
Provide access to the .NET composite formatting feature. A composite format
string consists of fixed text intermixed with indexed placeholders, called
_format items_. These format items correspond to the objects in the list.

Each format item takes the following form and consists of the following
components:

`{index[,alignment][:formatString]}`

The matching braces (`{` and `}`) are required.

The formatting operation yields a result string that consists of the original
fixed text intermixed with the string representation of the objects in the
list. For more information, [Composite Formatting][02].

Enter the composite format string on the left side of the operator and the
objects to be formatted on the right side of the operator.

```powershell
"{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi
Expand Down Expand Up @@ -477,9 +491,6 @@ escape them by doubling the curly braces.
foo vs. {0}
```

For more information, see the [String.Format][01] method and
[Composite Formatting][02].

### Index operator `[ ]`

Selects objects from indexed collections, such as arrays and hash tables. Array
Expand Down