external help file | Module Name | online version | schema |
---|---|---|---|
PSScriptTools-help.xml |
PSScriptTools |
2.0.0 |
Options for formatting strings.
Format-String [-Text] <String> [-Reverse] [-Case <String>]
[-Replace <Hashtable>] [-Randomize] [<CommonParameters>]
Use this command to apply different types of formatting to strings. You can apply multiple transformations.
They are applied in this order:
- Reverse
- Randomization
- Replace
- Case
PS C:\> "P@ssw0rd" | Format-String -Reverse
dr0wss@P
PS C:\> "P@ssw0rd" | Format-String -Reverse -Randomize
rs0Pd@ws
PS C:\> $env:computername | Format-String -Case Lower
win81-ent-01
PS C:\> Format-String "p*wer2she!!" -Case Alternate
P*WeR2ShE!!
PS C:\> Format-String "alphabet" -Randomize -Replace @{a="@";e=3} `
-Case Alternate
3bPl@tH@
PS C:\> "pOWERSHELL" | Format-String -Case Toggle
Powershell
Any string you want to format.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Reverse the text string.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Valid values are Upper, Lower, Proper, Alternate, and Toggle.
Proper case will capitalize the first letter of the string.
Alternate case will alternate between upper and lower case, starting with upper case, e.g. PoWeRsHeLl
Toggle case will make upper case lower and vice versa, e.g. Powershell -> pOWERSHELL
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specify a hashtable of replacement values. The hashtable key is the string you want to replace and the value is the replacement (see examples). Replacement keys are CASE SENSITIVE.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Re-arrange the text in a random order.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/