diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md index 3b7707835b3e..2d3f77043e90 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md @@ -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 @@ -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, see [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 @@ -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 @@ -600,7 +611,6 @@ properties and methods of an object, use the Static parameter of the - [about_Redirection][18] -[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 diff --git a/reference/7.2/Microsoft.PowerShell.Core/About/about_Operators.md b/reference/7.2/Microsoft.PowerShell.Core/About/about_Operators.md index f4821648dd4c..4b679ae8e201 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/About/about_Operators.md +++ b/reference/7.2/Microsoft.PowerShell.Core/About/about_Operators.md @@ -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 @@ -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, see [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 @@ -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 diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Operators.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Operators.md index 3160d3ee862c..d1b23767a2d4 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Operators.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Operators.md @@ -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 @@ -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, see [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 @@ -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 diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Operators.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Operators.md index a36f7b7211de..0bbb57e70849 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Operators.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Operators.md @@ -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 @@ -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, see [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 @@ -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