UnicodeReplace (Unicode function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 2: Line 2:
[[Category:Unicode methods|UnicodeReplace function]]
[[Category:Unicode methods|UnicodeReplace function]]
[[Category:Intrinsic methods]]
[[Category:Intrinsic methods]]
<!--DPL?? Category:Unicode methods|<var>UnicodeReplace</var> function: String after replacements from Unicode replacement table-->
<!--DPL?? Category:<var>Unicode</var> methods|<var>UnicodeReplace</var> function: <var>String</var> after replacements from <var>Unicode</var> replacement table-->
<!--DPL?? Category:Intrinsic methods|<var>UnicodeReplace</var> (Unicode function): String after replacements from Unicode replacement table-->
<!--DPL?? Category:Intrinsic methods|<var>UnicodeReplace</var> (<var>Unicode</var> function): <var>String</var> after replacements from <var>Unicode</var> replacement table-->
<!--DPL?? Category:System methods|<var>UnicodeReplace</var> (Unicode function): String after replacements from Unicode replacement table-->
<!--DPL?? Category:<var>System</var> methods|<var>UnicodeReplace</var> (<var>Unicode</var> function): <var>String</var> after replacements from <var>Unicode</var> replacement table-->


Items in the replacement table are created with <tt>UNICODE Rep</tt> update
Items in the replacement table are created with <tt>UNICODE Rep</tt> update
Line 15: Line 15:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th><i>%unicode</i></th>
<tr><th><i>%unicode</i></th>
<td>A Unicode variable to receive the method object string altered by any replacement characters. </td></tr>
<td>A <var>Unicode</var> variable to receive the method object string altered by any replacement characters. </td></tr>
<tr><th><i>unicode</i></th>
<tr><th><i>unicode</i></th>
<td>A Unicode string.</td></tr>
<td>A <var>Unicode</var> string.</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
<ul>
<ul>
<li>The method output is the input Unicode string, with those characters
<li>The method output is the input <var>Unicode</var> string, with those characters
specified in the Unicode replacement table
specified in the <var>Unicode</var> replacement table
replaced by their corresponding Unicode strings.
replaced by their corresponding <var>Unicode</var> strings.
If no Unicode replacement table is in effect,
If no <var>Unicode</var> replacement table is in effect,
the method merely copies its input.
the method merely copies its input.
</ul>
</ul>
Line 39: Line 39:
     UNICODE Table Standard Rep U=2122 '(TM)'
     UNICODE Table Standard Rep U=2122 '(TM)'
     Begin
     Begin
     %u Unicode Initial('Cool&amp;#x2122;':U)
     %u <var>Unicode</var> Initial('Cool&amp;#x2122;':U)
     Print %u:<var>UnicodeReplace</var>
     Print %u:<var>UnicodeReplace</var>
     End
     End

Revision as of 15:49, 20 January 2011

Apply the replacement table to this string (Unicode class)

Items in the replacement table are created with UNICODE Rep update commands, as described in ?? refid=updtuni..

The UnicodeReplace function is available as of version 7.3 of the Sirius Mods.

Syntax

%outUnicode = unicode:UnicodeReplace

Syntax terms

%unicode A Unicode variable to receive the method object string altered by any replacement characters.
unicode A Unicode string.

Usage notes

  • The method output is the input Unicode string, with those characters specified in the Unicode replacement table replaced by their corresponding Unicode strings. If no Unicode replacement table is in effect, the method merely copies its input.

Examples

The following example shows a successful call of UnicodeReplace. The U constant function is used in the example.

An updating UNICODE command is used "in-line" with the User Language request to make the example concrete. In actual usage, updating UNICODE commands should only be issued from your Model 204 initialization stream.

    UNICODE Table Standard Rep U=2122 '(TM)'
    Begin
    %u <var>Unicode</var> Initial('Cool&#x2122;':U)
    Print %u:<var>UnicodeReplace</var>
    End

The result is:

    Cool(TM)