「PowerShell」ToLowerメソッドで英字の大文字を小文字にする

環境
Windows 10 Home 64bit
Windows PowerShell 5.1.19041.1682

構文
文字列.ToLower()
ToLowerメソッドを利用して、英字の大文字を小文字にします。
英字の全角の大文字も全角の小文字に変換されます。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$strA = "ARKGAME"
Write-Host ($strA.ToLower())
$strB = "Study"
Write-Host ($strB.ToLower())
$strC = "ARKGAME"
Write-Host ($strC.ToLower())
$strD = "テスト"
Write-Host ($strD.ToLower())
$strA = "ARKGAME" Write-Host ($strA.ToLower()) $strB = "Study" Write-Host ($strB.ToLower()) $strC = "ARKGAME" Write-Host ($strC.ToLower()) $strD = "テスト" Write-Host ($strD.ToLower())
$strA =  "ARKGAME"
Write-Host ($strA.ToLower()) 

$strB =  "Study"
Write-Host ($strB.ToLower()) 

$strC =  "ARKGAME"
Write-Host ($strC.ToLower()) 

$strD =  "テスト"
Write-Host ($strD.ToLower())

実行結果

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
PS C:\study\skill\powershell> .\test02.ps1
arkgame
study
arkgame
テスト
PS C:\study\skill\powershell> .\test02.ps1 arkgame study arkgame テスト
PS C:\study\skill\powershell> .\test02.ps1
arkgame
study
arkgame
テスト

 

PowerShell

Posted by arkgame