diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..79e520a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "powershell.codeFormatting.addWhitespaceAroundPipe": true +} \ No newline at end of file diff --git a/15_kentucky_friar/friar.ps1 b/15_kentucky_friar/friar.ps1 index 956d2d6..08763e7 100644 --- a/15_kentucky_friar/friar.ps1 +++ b/15_kentucky_friar/friar.ps1 @@ -25,8 +25,13 @@ function Invoke-Fry { } if ($word.EndsWith('ing')) { - $word.Substring(0, ($word.Length - 1)) + "'" - } + if ($word.Substring(0, ($word.Length - 3)).IndexOfAny('AaEeIiOoUuYy'.ToCharArray()) -gt -1) { + $word.Substring(0, ($word.Length - 1)) + "'" + } + else { + $word + } + } } if (Test-Path $text -ErrorAction SilentlyContinue) { diff --git a/15_kentucky_friar/solution1.ps1 b/15_kentucky_friar/solution1.ps1 index 956d2d6..08763e7 100644 --- a/15_kentucky_friar/solution1.ps1 +++ b/15_kentucky_friar/solution1.ps1 @@ -25,8 +25,13 @@ function Invoke-Fry { } if ($word.EndsWith('ing')) { - $word.Substring(0, ($word.Length - 1)) + "'" - } + if ($word.Substring(0, ($word.Length - 3)).IndexOfAny('AaEeIiOoUuYy'.ToCharArray()) -gt -1) { + $word.Substring(0, ($word.Length - 1)) + "'" + } + else { + $word + } + } } if (Test-Path $text -ErrorAction SilentlyContinue) { diff --git a/15_kentucky_friar/test.ps1 b/15_kentucky_friar/test.ps1 index 468edf5..8a72d46 100644 Binary files a/15_kentucky_friar/test.ps1 and b/15_kentucky_friar/test.ps1 differ