Created
June 17, 2020 15:52
-
-
Save AspenForester/40405f8dbd047569d2a2c18d74ef1f60 to your computer and use it in GitHub Desktop.
My approach to the basic problem of the June 16, 2020 Iron Scripter Challenge. Very basic, not a function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Text = "EnVeLoPe" | |
$result = switch ($Text.ToCharArray()) { | |
{$_ -in ('a','b','c')} { "2"; continue } | |
{$_ -in ('d','e','f')} { "3"; continue } | |
{$_ -in ('g','h','i')} { "4"; continue } | |
{$_ -in ('j','k','l')} { "5"; continue } | |
{$_ -in ('m','n','o')} { "6"; continue } | |
{$_ -in ('p','q','r','s')} { "7"; continue } | |
{$_ -in ('t','u','v')} { "8"; continue } | |
{$_ -in ('w','x','y','z')} { "9"; continue } | |
Default {} | |
} | |
$result -join "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment