我自己想出来了。
您可以将 a 转换char为intwith:int('a')或ord('a')。
"a" in Nim is a string, not a char. So at first you need to get the character you want the ASCII code from. In this case the first character inside the string.
So int(char("a"[0])) would give the ASCII code for the first character inside a string.
The same procedure works also in the other direction. To convert an ASCII code into a character, you do char(97) and get 'a'.