From 179094d4ed7771ed873b2c1c259f3ff3d947a05e Mon Sep 17 00:00:00 2001 From: jnre Date: Wed, 25 Nov 2020 09:23:40 +0800 Subject: [PATCH] digi 2 ascii conversion --- Scripts/DIGI2ASCII.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Scripts/DIGI2ASCII.js diff --git a/Scripts/DIGI2ASCII.js b/Scripts/DIGI2ASCII.js new file mode 100644 index 00000000..07579b4f --- /dev/null +++ b/Scripts/DIGI2ASCII.js @@ -0,0 +1,24 @@ +/** +{ + "api": 1, + "name": "Digi to ASCII", + "description": "Digi to ASCII", + "author": "Joseph Ng Rong En", + "icon": "dice", + "tags": "ascii,digi" +} +**/ + +function digi2a(str) { + var split = str.split(/[ ,]+/); + var arr = []; + for (var i = 0, l = split.length; i < l; i ++) { + var ascii = String.fromCharCode(split[i]); + arr.push(ascii); + } + return arr.join(''); +} + +function main(input) { + input.text = digi2a(input.text); +} \ No newline at end of file