Warning: Undefined variable $yXKkDYs in /sites/1045.node9.isx.dk/wp-includes/category.php on line 1

Warning: Undefined variable $tuxtEpW in /sites/1045.node9.isx.dk/wp-includes/class-wp-comment-query.php on line 1

Warning: Undefined variable $YdTevXu in /sites/1045.node9.isx.dk/wp-includes/class-walker-comment.php on line 1

Warning: Undefined variable $RrVJlcuUCy in /sites/1045.node9.isx.dk/wp-includes/rewrite.php on line 1

Warning: Undefined variable $amfNQO in /sites/1045.node9.isx.dk/wp-includes/functions.wp-scripts.php on line 1

Warning: Undefined variable $LMVtjJXM in /sites/1045.node9.isx.dk/wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php on line 1

Warning: Undefined variable $IEFdWoE in /sites/1045.node9.isx.dk/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php on line 1

Warning: Undefined variable $noZMGqRr in /sites/1045.node9.isx.dk/wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php on line 1

Warning: Undefined variable $SqhXXXHo in /sites/1045.node9.isx.dk/wp-includes/blocks/navigation-link.php on line 1

Warning: Undefined variable $FJopptB in /sites/1045.node9.isx.dk/wp-includes/blocks/social-link.php on line 1

Deprecated: Implicit conversion from float 2.5384615384615383 to int loses precision in /sites/1045.node9.isx.dk/wp-content/plugins/ninja-forms/includes/Actions/ajax.php on line 52

Deprecated: Implicit conversion from float 2.5384615384615383 to int loses precision in /sites/1045.node9.isx.dk/wp-content/plugins/ninja-forms/includes/Actions/ajax.php on line 52

Deprecated: Implicit conversion from float 1.1851851851851851 to int loses precision in /sites/1045.node9.isx.dk/wp-content/plugins/ninja-forms/includes/Actions/ajax.php on line 52

Notice: Function register_block_patterns was called incorrectly. Could not register file "/sites/1045.node9.isx.dk/wp-content/plugins/woocommerce/patterns/js.php" as a block pattern ("Slug" field missing) Please see Debugging in WordPress for more information. (This message was added in version 6.0.0.) in /sites/1045.node9.isx.dk/wp-includes/functions.php on line 6031
Leetspeak Nim – 1X

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"
  stdout.flushFile()

when isMainModule:
  main()

Compile and run with:

nim c -r leet.nim Hello World

Related posts