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일 · 유용했나요?