built-in reverse

文字列の反転
文字列の反転 PowerShellにて
function ReverseString([string] $String) {
    $charArray = $String.ToCharArray()
    [Array]::Reverse($charArray)
    -join $charArray
}

First, we turn the string into an array of chars. Then, we pass the char array into the static method Reverse of the class Array from .NET. Finally, we use -join to concatenate this char array back into one single string.

Array.Reverse method.

2026年09月23日(水) · 役に立ちましたか?