base64.decode: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page Base64.decode to base64.decode: Converting page titles to lowercase)
m (Text replacement - "source>" to "syntaxhighlight>")
Line 9: Line 9:
<source lang="mtmacro" line>
<source lang="mtmacro" line>
base64.decode(string)
base64.decode(string)
</source>
</syntaxhighlight>
'''Parameters'''
'''Parameters'''
{{param|string|The base64 encoded string to be decoded.}}
{{param|string|The base64 encoded string to be decoded.}}
Line 19: Line 19:
[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></source>
[r: base64.decode(encTxt)]<br></syntaxhighlight>
'''Returns:'''
'''Returns:'''
<source lang="mtmacro" line>
<source lang="mtmacro" line>
Line 25: Line 25:
Rm91ciBzY29yZSBhbmQgc2V2ZW4geWVhcnMgYWdvLi4u  
Rm91ciBzY29yZSBhbmQgc2V2ZW4geWVhcnMgYWdvLi4u  
Four score and seven years ago...
Four score and seven years ago...
</source>
</syntaxhighlight>


|also=
|also=

Revision as of 16: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

<source lang="mtmacro" line> base64.decode(string) </syntaxhighlight> Parameters

  • string - The base64 encoded string to be decoded.

Example

Encode a string and then decode it.

<source lang="mtmacro" line> [r: txt = "Four score and seven years ago..."]
[r: encTxt = base64.encode(txt)]
[r: base64.decode(encTxt)]
</syntaxhighlight> Returns: <source lang="mtmacro" line> Four score and seven years ago... Rm91ciBzY29yZSBhbmQgc2V2ZW4geWVhcnMgYWdvLi4u Four score and seven years ago...

</syntaxhighlight>

See Also