PowerShell: Can turn more words in the line as if they were seen in the mirror?

Nicu F 61 Reputation points
2021-10-27T08:33:25.753+00:00

hello. Can turn more words in the line as if they were seen in the mirror, using PowerShell?

For example:

On summer vacation it was great.

THE OUTPUT:

No remmus noitacav ti saw taerg.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,364 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 44,776 Reputation points
    2021-10-27T18:44:55.247+00:00

    Do you care about punctuation being considered a part of a word? Preservation of spaces (e.g. multiple spaces between words)? If not, then:

    $f = "On summer vacation it was great."
    $r = ""
    $f.split(' ') |
        ForEach-Object{
            for ($i = $_.Length-1; $i -ge 0; $i--){
                $r += $_[$i]
            }
            $r += " "
        }
    $r.trim()
    

0 additional answers

Sort by: Most helpful