| aa_macro syntax |
| aa_macro source |
| HTML source |
| HTML render |
4.63 - [translate] Built-In
Mnemonic aid: translate for TRANSLATE characters
See also: [aisort] , [append] , [asort] , [clearl] , [cmap] , [dlist] , [e] , [hmap] , [isort] , [lcc] , [lcopy] , [lhsort] , [list] , [ljoin] , [llen] , [lpop] , [lset] , [lslice] , [lsplit] , [lsub] and [ltol]
This built-in allows you to translate a character string into any arbitrary code that is in a 256-entry list. The example shows [hmap] being used to generate a 256-entry list of hexadecimal values, and then that list being used with [translate] to create a string of hexadecimal constants.
One of the things about aa_macro's syntax is that because commas are used to separate parameters, and because processing resolves all internal aa_macro language from the inside out, is that you can't really embed actual commas in text.
This demonstrates a way to get around this using the [fref] command and the hex=1 option of the [resolve] command. Because [resolve] does its replacements the very last thing in text processing, and because the hex=1 option allows you to specity any character string, you can go back and replace anything you need to. In this example, it is used to place a comma everywhere one is needed.
[translate pre=0x,inter=[fref co],list1,my text string]
Other built-ins used here: [fref] , [hmap] and [resolve]