Skip to content

Instantly share code, notes, and snippets.

@pdxwolfy
Created March 19, 2016 18:50
Show Gist options
  • Save pdxwolfy/3ade83a4db0444c19794 to your computer and use it in GitHub Desktop.
Save pdxwolfy/3ade83a4db0444c19794 to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
#
# Copyright (c) 2016 Pete Hanson
def smash(string)
string.each_char.select { |char| char =~ /\A[a-z]\Z/i }.join ' '
end
puts smash('Hello, world!') # -> H e l l o w o r l d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment