$Str: Difference between revisions
(Automatically generated page update) |
(Automatically generated page update) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Treat a longstring as string</span> | <span class="pageSubtitle">Treat a longstring as string</span> | ||
<p class="warn"><b>Note: </b> | <p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $Str function.</p> | ||
This function takes a longstring input and produces a string output, silently truncating the result at 255 bytes or shorter if the target is shorter. | This function takes a longstring input and produces a string output, silently truncating the result at 255 bytes or shorter if the target is shorter. | ||
Line 30: | Line 30: | ||
<li>[[List of $functions|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>[[Media:JoclrNew.pdf|Janus Open Client]</li> | <li>[[Media:JoclrNew.pdf|Janus Open Client]]</li> | ||
<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>[ | <li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li> | ||
</ul> | </ul> | ||
[[Category:$Functions|$Str]] | [[Category:$Functions|$Str]] |
Latest revision as of 23:28, 20 September 2018
Treat a longstring as string
Note: Many $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $Str function.
This function takes a longstring input and produces a string output, silently truncating the result at 255 bytes or shorter if the target is shorter.
The $Str function accepts one argument and returns a string result that is the first argument truncated at the $function target's length.
The first argument is an arbitrary string.
Syntax
%str = $Str(longstring)
%str is up to the first 255 bytes of longstring.
Usage notes
- The main utility of the $Str function is to prevent the request cancellation that would result from a direct assignment from a Longstring value to a String %variable that is too small to hold the entire value. While the input to $Str could be a regular String, this doesn't really make much sense since a regular String can be assigned to a regular String without request cancellation for truncation, anyway.
A $Str would upgrade an argument With expression to a Longstring With expression, but this is again rather silly as the result would then simply be truncated at 255 bytes if it exceeds 255 bytes.
- $Str also makes sense as a quick shorthand for the first 255 bytes of a Longstring, even if the target is a Longstring.