Created
September 25, 2020 20:58
-
-
Save FrazzIe/ba3928ecee841c5deff7466f7f4e5f8b to your computer and use it in GitHub Desktop.
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
| /* | |
| Basic example: | |
| asciiMap = asciiMap(); | |
| F = asciiMap["toNumber"]["F"] + asciiMap["offset"]; | |
| G = asciiMap["toChar"][71 - asciiMap["offset"]]; | |
| */ | |
| asciiMap() { | |
| ascii = "! \" # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \\ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~"; | |
| ascii = strTok(ascii, " "); | |
| asciiMap = []; | |
| asciiMap["toChar"] = []; | |
| asciiMap["toNumber"] = []; | |
| asciiMap["offset"] = 32; | |
| asciiMap["toChar"][0] = " "; | |
| asciiMap["toNumber"][" "] = 0; | |
| for (id = 0; id < ascii.size; id++) { | |
| asciiMap["toChar"][id + 1] = ascii[id]; | |
| asciiMap["toNumber"][ascii[id]] = id + 1; | |
| } | |
| return asciiMap; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment