Created
March 19, 2016 18:50
-
-
Save pdxwolfy/3ade83a4db0444c19794 to your computer and use it in GitHub Desktop.
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
# 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