base64.decode: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{MacroFunction |name=base64.decode |trusted=false |version=1.5.2 |description= Accepts a [https://en.wikipedia.org/wiki/Base64 Base64] encoded string and decodes it to plain...") |
m (Text replacement - "<source" to "<syntaxhighlight") |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 7: | Line 7: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
base64.decode(string) | base64.decode(string) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|string|The base64 encoded string to be decoded.}} | {{param|string|The base64 encoded string to be decoded.}} | ||
Line 16: | Line 16: | ||
Encode a string and then decode it. | Encode a string and then decode it. | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: txt = "Four score and seven years ago..."]<br> | [r: txt = "Four score and seven years ago..."]<br> | ||
[r: encTxt = base64.encode(txt)]<br> | [r: encTxt = base64.encode(txt)]<br> | ||
[r: base64.decode(encTxt)]<br></ | [r: base64.decode(encTxt)]<br></syntaxhighlight> | ||
'''Returns:''' | '''Returns:''' | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
Four score and seven years ago... | Four score and seven years ago... | ||
Rm91ciBzY29yZSBhbmQgc2V2ZW4geWVhcnMgYWdvLi4u | Rm91ciBzY29yZSBhbmQgc2V2ZW4geWVhcnMgYWdvLi4u | ||
Four score and seven years ago... | Four score and seven years ago... | ||
</ | </syntaxhighlight> | ||
|also= | |also= | ||
{{func|base64.encode}} | |||
}} | }} | ||
[[Category:Miscellaneous Function]] | [[Category:Miscellaneous Function]] |
Latest revision as of 23:59, 14 March 2023
base64.decode() Function
• Introduced in version 1.5.2
Accepts a Base64 encoded string and decodes it to plain text.
Usage
base64.decode(string)
Parameters
string
- The base64 encoded string to be decoded.
Example
Encode a string and then decode it.
[r: txt = "Four score and seven years ago..."]<br>
[r: encTxt = base64.encode(txt)]<br>
[r: base64.decode(encTxt)]<br>
Returns:
Four score and seven years ago...
Rm91ciBzY29yZSBhbmQgc2V2ZW4geWVhcnMgYWdvLi4u
Four score and seven years ago...