Skip to content

Instantly share code, notes, and snippets.

@DrunkenAlcoholic
Created May 14, 2024 03:55
Show Gist options
  • Save DrunkenAlcoholic/32e5814dc1a81a5838ac64e2666d11a1 to your computer and use it in GitHub Desktop.
Save DrunkenAlcoholic/32e5814dc1a81a5838ac64e2666d11a1 to your computer and use it in GitHub Desktop.
Acronym [Exercism - Nim]
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