ConvertFrom-StringToByteArray
SYNOPSIS
Converts a string to a byte array object.
SYNTAX
ConvertFrom-StringToByteArray [-String] <String[]> [[-Encoding] <String>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
DESCRIPTION
Converts a string to a byte array object.
EXAMPLES
EXAMPLE 1
$bytes = ConvertFrom-StringToByteArray -String 'A string'
$bytes.GetType()
IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Byte[] System.Array
$bytes[0].GetType()
IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Byte System.ValueType
EXAMPLE 2
$bytes = 'A string','Another string' | ConvertFrom-StringToByteArray
$bytes.Count 2
$bytes.GetType()
IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Object[] System.Array
$bytes[0].GetType()
IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Byte[] System.Array
PARAMETERS
-String
A string object for conversion.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
-Encoding
The encoding to use for conversion. Defaults to UTF8. Valid options are ASCII, BigEndianUnicode, Default, Unicode, UTF32, and UTF8.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: UTF8
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
OUTPUTS
[System.Collections.Generic.List[Byte[]]]
NOTES
RELATED LINKS
https://austoonz.github.io/Convert/functions/ConvertFrom-StringToByteArray/