StringToBase64 (String function): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (1 revision) |
||
Line 1: | Line 1: | ||
{{Template:String:StringToBase64 subtitle}} | {{Template:String:StringToBase64 subtitle}} | ||
This [[Intrinsic classes|intrinsic]] function returns the base-64 encoded value of the method object string. | This [[Intrinsic classes|intrinsic]] function returns the base-64 encoded value of the method object string. | ||
StringToBase64 is available as of version 7.2 of the [[Sirius Mods]]. | StringToBase64 is available as of version 7.2 of the [[Sirius Mods]]. | ||
==Syntax== | ==Syntax== | ||
{{Template:String:StringToBase64 syntax}} | {{Template:String:StringToBase64 syntax}} | ||
Line 13: | Line 13: | ||
<td>The string to be base-64 encoded.</td></tr> | <td>The string to be base-64 encoded.</td></tr> | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
*Base-64 encoding is useful for encoding strings that might contain binary or other characters that could cause problems in certain contexts. For example, binary characters can be problematic when sent in e-mail. <br>Base-64 encoding is an alternative to hexadecimal encoding. Hexadecimal encoding has the advantage that it's simpler, but as the disadvantage that it requires two bytes for every encoded byte. Base-64 encoding, because it uses more characters (64, as the name would suggest), only requires four bytes for every three encoded bytes. | *Base-64 encoding is useful for encoding strings that might contain binary or other characters that could cause problems in certain contexts. For example, binary characters can be problematic when sent in e-mail. <br>Base-64 encoding is an alternative to hexadecimal encoding. Hexadecimal encoding has the advantage that it's simpler, but as the disadvantage that it requires two bytes for every encoded byte. Base-64 encoding, because it uses more characters (64, as the name would suggest), only requires four bytes for every three encoded bytes. | ||
*A complete explanation of base-64 encoding can be easily found on the Internet or in many software textbooks. | *A complete explanation of base-64 encoding can be easily found on the Internet or in many software textbooks. | ||
*The StringToBase64 function returns the standard base-64 encoding of a string, where the encoded string is padded out to an even multiple of four bytes by appending equal signs. | *The StringToBase64 function returns the standard base-64 encoding of a string, where the encoded string is padded out to an even multiple of four bytes by appending equal signs. | ||
*The inverse of StringToBase64 is [[Base64toString (String function)|Base64toString]] | *The inverse of StringToBase64 is [[Base64toString (String function)|Base64toString]] | ||
==Examples== | ==Examples== | ||
The following statement displays ''''8PHy8/T19vf4+Q=='''': | The following statement displays ''''8PHy8/T19vf4+Q=='''': | ||
[[Intrinsic classes#printtext|printText]] {'0123456789':stringTobase64} | [[Intrinsic classes#printtext|printText]] {'0123456789':stringTobase64} | ||
===See also=== | ===See also=== | ||
[[List of intrinsic String methods]] | [[List of intrinsic String methods]] | ||
[[Category:Intrinsic String methods|StringToBasic64 function]] | [[Category:Intrinsic String methods|StringToBasic64 function]] | ||
[[Category:Intrinsic methods]] | [[Category:Intrinsic methods]] |
Revision as of 14:04, 19 January 2011
Convert an Ebcdic string to base 64 (String class)
This intrinsic function returns the base-64 encoded value of the method object string.
StringToBase64 is available as of version 7.2 of the Sirius Mods.
Syntax
%outString = string:StringToBase64
Syntax terms
%outStr | A string variable to receive the base-64 encoded value of the method object string. |
---|---|
string | The string to be base-64 encoded. |
Usage notes
- Base-64 encoding is useful for encoding strings that might contain binary or other characters that could cause problems in certain contexts. For example, binary characters can be problematic when sent in e-mail.
Base-64 encoding is an alternative to hexadecimal encoding. Hexadecimal encoding has the advantage that it's simpler, but as the disadvantage that it requires two bytes for every encoded byte. Base-64 encoding, because it uses more characters (64, as the name would suggest), only requires four bytes for every three encoded bytes. - A complete explanation of base-64 encoding can be easily found on the Internet or in many software textbooks.
- The StringToBase64 function returns the standard base-64 encoding of a string, where the encoded string is padded out to an even multiple of four bytes by appending equal signs.
- The inverse of StringToBase64 is Base64toString
Examples
The following statement displays '8PHy8/T19vf4+Q==':
printText {'0123456789':stringTobase64}