Skip to content

Commit

Permalink
Simplify casing
Browse files Browse the repository at this point in the history
  • Loading branch information
BNAndras committed Jul 3, 2024
1 parent 5ed82f7 commit 05c6a2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions exercises/practice/pig-latin/.meta/example.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
function translate(phrase)
words = split(phrase, " ")
fragments = map(translate_fragment, words)
fragments = map(translatefragment, words)

join(fragments, " ")
end

vowelsound = r"^([aeiou]|xr|yt)"
consonantsound = r"^([^aeiou]+(?=y)|[^aeiou]?qu|[^aeiou]+)([a-z]+)"

function translate_fragment(fragment)
function translatefragment(fragment)
translated = fragment
if !occursin(vowelsound, fragment)
translated = replace(fragment, consonantsound => s"\g<2>\g<1>")
Expand Down

0 comments on commit 05c6a2a

Please sign in to comment.