Skip to content

Instantly share code, notes, and snippets.

@WA9ACE
Created February 12, 2015 00:24
Show Gist options
  • Save WA9ACE/0dd9764786ecbdd7c564 to your computer and use it in GitHub Desktop.
Save WA9ACE/0dd9764786ecbdd7c564 to your computer and use it in GitHub Desktop.
Quick and dirty, not tested.
def nearby_az(string)
raise ArgumentError if !string.include? 'a'
a_idx = string.index("a")
string[a_idx + 1] == "z" || string[a_idx + 2] == "z" || string[a_idx +3] == "z"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment