Leetspeak Nim

Yes, Leetspeak was a thing…

This code shows som string mangling and access to argv command line items.

import std/strutils
import std/os

proc leetspeak(s: string): string =
  let r = s.toUpper()
  const leetfabet = [("E","3"), ("B","8"), ("C","["), ("L","1"), ("O","0"), ("A","4")]
  return r.multiReplace( leetfabet )

proc main() =
  for i in countup(1,paramCount()):
    if i>1:
      stdout.write " "
    stdout.write leetspeak(paramStr(i))
  stdout.write "\n"

when isMainModule:

Compile and run with:

nim c -r leet.nim Hello World