Convert-String

Convert-String and PowerShell Core: Convert-String is not available in PowerShell Core 6.1. It may reappear in a later version, or may be moved to a separate module.

The Convert-String command may be used to simplify some string conversion operations. The conversion is performed based on an example that must be supplied. For example, Convert-String can generate account names from a list of users:

'Michael Caine', 'Benny Hill', 'Raf Vallone' | Convert-String -Example 'Michael Caine=MCaine' 

The Example parameter uses the generalized syntax as follows:

<Before>=<After> 

This example text does not have to be one of the set being converted. For example, the following will work:

'Michael Caine', 'Benny Hill', 'Raf Vallone' | Convert-String -Example 'First Second=FSecond' 

The following alternate syntax is also supported:

'Michael Caine', 'Benny Hill', 'Raf Vallone' | Convert-String -Example @{ 
    Before = 'First Second' 
    After = 'FSecond' 
} 

The Convert-String command is not without its limitations. After may only include strings, or partial strings, from Before, along with a subset of punctuation characters. Characters that aren't permitted in After include @, $, ~, `, and !. Because of these limitations, Convert-String cannot, for example, build an email address for each user in the list in a single step.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.42.84