Created
May 14, 2024 03:55
-
-
Save DrunkenAlcoholic/32e5814dc1a81a5838ac64e2666d11a1 to your computer and use it in GitHub Desktop.
Acronym [Exercism - Nim]
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
import strutils | |
proc abbreviate*(s: string): string = | |
var str = s.replace(" -", " ") | |
str = str.replace("_") | |
str = str.replace("-", " ") | |
str = str.replace(" ", " ") | |
for word in str.split(" "): | |
result &= word[0].toUpperAscii |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment