Created
April 11, 2019 16:42
-
-
Save elcortez/3197ae2f567d157676489c8629866d22 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| def better_acronymise(string) | |
| return string.split.map { |word| word[0].upcase}.join | |
| end | |
| p better_acronymise("Frequently Asked Question") | |
| puts better_acronymise("Frequently Asked Question") == "FAQ" | |
| p better_acronymise("Bois d'Arcy") | |
| puts better_acronymise("Bois d'Arcy") == "BD" | |
| p better_acronymise(" Hello World ") | |
| puts better_acronymise(" Hello World ") == "HW" | |
| p better_acronymise("") | |
| puts better_acronymise("") == "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment