StrConve関数
#https://msdn.microsoft.com/ja-jp/library/microsoft.visualbasic.vbstrconv(v=vs.110).aspx function StrConv{ param( [parameter(mandatory)] [string]$String, [parameter(mandatory)] [ValidateSet("Hiragana", "Katakana", "LinguisticCasing", "Lowercase", "Narrow", ` "None", "ProperCase", "SimplifiedChinese", "TraditionalChinese", ` "Uppercase", "Wide")] [string]$Conversion ) #[void][reflection.assembly]::LoadWithPartialName("Microsoft.VisualBasic") Add-Type -AssemblyName "Microsoft.VisualBasic" switch($Conversion){ "Hiragana"{$vbConvert = [Microsoft.VisualBasic.VbStrConv]::Hiragana} "Katakana"{$vbConvert = [Microsoft.VisualBasic.VbStrConv]::Katakana} "LinguisticCasing"{$vbConvert = [Microsoft.VisualBasic.VbStrConv]::LinguisticCasing} "Lowercase"{$vbConvert = [Microsoft.VisualBasic.VbStrConv]::Lowercase} "Narrow"{$vbConvert = [Microsoft.VisualBasic.VbStrConv]::Narrow} "None"{$vbConvert = [Microsoft.VisualBasic.VbStrConv]::None} "ProperCase"{$vbConvert = [Microsoft.VisualBasic.VbStrConv]::ProperCase} "SimplifiedChinese"{$vbConvert = [Microsoft.VisualBasic.VbStrConv]::SimplifiedChinese} "TraditionalChinese"{$vbConvert = [Microsoft.VisualBasic.VbStrConv]::TraditionalChinese} "Uppercase"{$vbConvert = [Microsoft.VisualBasic.VbStrConv]::Uppercase} "Wide"{$vbConvert = [Microsoft.VisualBasic.VbStrConv]::Wide} } return [Microsoft.VisualBasic.Strings]::StrConv($String, $vbConvert) }
使い方
パラメーターは変換する文字列とStrConv列挙体の値を指定します。StrConv列挙体の値は対象を一覧表示できるので値を選択するだけです。