1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-04-26 16:51:30 +00:00

Add charcode operator to make it easier to generate strings containing control characters

Avoids some confusing hacks. @saqimtiaz I'm guessing you might have already done something like this?
This commit is contained in:
jeremy@jermolene.com
2021-06-22 21:52:00 +01:00
parent 63fa0c4fa4
commit 83ee363cb4
4 changed files with 40 additions and 0 deletions

View File

@@ -172,4 +172,14 @@ exports.pad = function(source,operator,options) {
return results;
}
exports.charcode = function(source,operator,options) {
var chars = [];
$tw.utils.each(operator.operands,function(operand) {
if(operand !== "") {
chars.push(String.fromCharCode($tw.utils.parseInt(operand)));
}
});
return [chars.join("")];
};
})();