$Lstr Base64 Decode: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:$Lstr_Base64_Decode}} <span class="pageSubtitle"><section begin="desc" />Convert from base 64 to byte string<section end="desc" /></span> <p class="warning">Most ...")
 
(Automatically generated page update)
 
(38 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Lstr_Base64_Decode}}
{{DISPLAYTITLE:$Lstr_Base64_Decode}}
<span class="pageSubtitle"><section begin="desc" />Convert from base 64 to byte string<section end="desc" /></span>
<span class="pageSubtitle">Convert from base 64 to byte string</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_Base64_Decode function is [[to be entered]].</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_Base64_Decode function is the <var>[[Base64ToString (String function)|Base64ToString]]</var> function.</p>


 
This function converts from a base 64 encoded string to the decoded byte string. It is identical to [[$Base64_Decode]], except it is longstring capable.  
 
This function converts from a base 64 encoded string to the decoded byte string. It is identical to $Base64_Decode (:hdref refid=b64dec.), except it is longstring capable.  


The $Lstr_Base64_Decode function accepts one argument and returns a string result whose base 64 encoding is that argument.  
The $Lstr_Base64_Decode function accepts one argument and returns a string result whose base 64 encoding is that argument.  
Line 13: Line 11:


The returned value is the base 64 decoding of the argument string. If the argument is not a valid base 64 encoding, the null string is returned.
The returned value is the base 64 decoding of the argument string. If the argument is not a valid base 64 encoding, the null string is returned.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %DECODED = $Lstr_Base64_Decode(string)
<p class="syntax"><span class="term">%DECODED</span> = <span class="literal">$Lstr_Base64_Decode</span>(<span class="term">string</span>)
<section end="syntax" /></p>
<p class="caption">$Lstr_Base64_Decode Function
</p>
</p>
<p class="caption">%DECODED is set to the base 64 decoding of :hp1.string:ehp1..</p>


<p>%DECODED is set to the base 64 decoding of <var class="term">string</var>.</p>


For example, given the following argument of length 4:
==Usage notes==
<p class="code"> %JUNK = $Lstr_Base64_Decode('ABCD')
<ul>
</p>
<li>You can check for an invalid base 64 encoding by checking for the null string return value from $Lstr_Base64_Decode. Of course, if it is possible that the argument is null, the null string is a valid returned value. If you need to check for errors, and the null string is a possible argument value, you can use an approach such as the following:
%JUNK is set to the byte string (of length 3) represented in hexadecimal as X'001083'.


You can check for an invalid base 64 encoding by checking for the null string return value from $Lstr_Base64_Decode. Of course, if it is possible that the argument is null, the null string is a valid returned value. If you need to check for errors, and the null string is a possible argument value, you can use an approach such as the following:
<p class="code">%STR = $Lstr_Base64_Decode(%IN)
<p class="code"> %STR = $Lstr_Base64_Decode(%IN)
IF %STR EQ &apos;&apos;
IF %STR EQ ''
  IF %IN NE &apos;&apos; THEN
IF %IN NE '' THEN
      error code ...
error code ...
  END IF
END IF
END IF
END IF
</p>
</p>


<li><var>[[$Lstr_Base64_Encode]]</var> is the inverse of $Lstr_Base64_Decode.
</ul>


$Lstr_Base64_Encode (:hdref refid=b64encl.) is the inverse of $Lstr_Base64_Decode.
==Example==
Given the following argument of length 4:


This $function is new in Version 6.8 of the ''[[Sirius Mods]]''.<p>
<p class="code">%JUNK = $Lstr_Base64_Decode('ABCD')
</p>


%JUNK is set to the byte string (of length 3) represented in hexadecimal as X'001083'.
==Products authorizing {{PAGENAMEE}}==
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[List of $functions|Sirius functions]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Janus Open Client]]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[[Janus Open Server]]</li>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Japanese functions]]</li>
<li>Japanese functions</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>


</ul>
</ul>
   
   
</p>
<p class="caption">Products authorizing $Lstr_Base64_Decode
</p>
[[Category:$Functions|$Lstr_Base64_Decode]]
[[Category:$Functions|$Lstr_Base64_Decode]]

Latest revision as of 22:51, 20 September 2018

Convert from base 64 to byte string

Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_Base64_Decode function is the Base64ToString function.

This function converts from a base 64 encoded string to the decoded byte string. It is identical to $Base64_Decode, except it is longstring capable.

The $Lstr_Base64_Decode function accepts one argument and returns a string result whose base 64 encoding is that argument.

The first argument is a longstring which is a base 64 encoding.

The returned value is the base 64 decoding of the argument string. If the argument is not a valid base 64 encoding, the null string is returned.

Syntax

%DECODED = $Lstr_Base64_Decode(string)

%DECODED is set to the base 64 decoding of string.

Usage notes

  • You can check for an invalid base 64 encoding by checking for the null string return value from $Lstr_Base64_Decode. Of course, if it is possible that the argument is null, the null string is a valid returned value. If you need to check for errors, and the null string is a possible argument value, you can use an approach such as the following:

    %STR = $Lstr_Base64_Decode(%IN) IF %STR EQ '' IF %IN NE '' THEN error code ... END IF END IF

  • $Lstr_Base64_Encode is the inverse of $Lstr_Base64_Decode.

Example

Given the following argument of length 4:

%JUNK = $Lstr_Base64_Decode('ABCD')

%JUNK is set to the byte string (of length 3) represented in hexadecimal as X'001083'.

Products authorizing $Lstr_Base64_Decode