Update (CharacterMap subroutine): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
 
mNo edit summary
 
Line 1: Line 1:
{{Template:CharacterMap:Update subtitle}}
{{Template:CharacterMap:Update subtitle}}
<p>
</p>


The method lets you modify existing character associations or add new ones.
The method lets you modify existing character associations or add new ones.
The method's parameters and mapping rules are the same as the
The method's parameters and mapping rules are the same as the <var>[[New (CharacterMap constructor)|New]]</var> method.
[[New (CharacterMap constructor)|New]] method.
 
==Syntax==
==Syntax==
{{Template:CharacterMap:Update syntax}}
{{Template:CharacterMap:Update syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>characterMap</th>
<tr><th>characterMap</th>
<td>A <var>CharacterMap</var> object.</td></tr>
<td>A <var>CharacterMap</var> object.</td></tr>
<tr><th><var>In</var></th>
<tr><th><var>In</var></th>
<td>A required, name required, argument that specifies the "input table" characters that you are adding or resetting.
<td>A required, [[Notation conventions for methods#Named parameters|name required]], argument that specifies the "input table" characters that you are adding or resetting. No character can be specified more than once in the <var>In</var> string, which may not be more than 256 characters.</td></tr>
No character can be specified more than once in the In string, which may not be more than 256 characters.</td></tr>
 
<tr><th><var>Out</var></th>
<tr><th><var>Out</var></th>
<td>An optional, name required, argument that specifies the "output table" characters.
<td>An optional, name required, argument that specifies the "output table" characters.
The <var>Out</var> string may not be longer than the <var>In</var> string; it may be shorter, however, as long as a <var>Pad</var> character is specified. The <var>Out</var> string may not be more than 256 characters.</td></tr>
The <var>Out</var> string may not be longer than the <var>In</var> string; it may be shorter, however, as long as a <var>Pad</var> character is specified. The <var>Out</var> string may not be more than 256 characters.</td></tr>
<tr><th><var>Pad</var></th>
<tr><th><var>Pad</var></th>
<td>An optional, name required, argument that specifies the character used to pad the output table string on the right if it is shorter than the <var>In</var> string.
<td>An optional, name required, argument that specifies the character used to pad the output table string on the right if it is shorter than the <var>In</var> string. <var>Pad</var> must be a single character, only.</td></tr>
<var>Pad</var> must be a single character, only.
</td></tr>
</table>
</table>


Line 27: Line 26:
<ul>
<ul>
<li>Case is respected in all character specifications.
<li>Case is respected in all character specifications.
<li>If an In string character you specify is already mapped in the method object,
 
<li>If an <var>In</var> string character you specify is already mapped in the method object,
the existing mapping is modified by the association indicated in the <var>Update</var> call.
the existing mapping is modified by the association indicated in the <var>Update</var> call.
If an In string character you specify is not already mapped, the association
If an <var>In</var> string character you specify is not already mapped, the association
indicated in the <var>Update</var> call is added to the method object's mapping.
indicated in the <var>Update</var> call is added to the method object's mapping.
<li>If the In string is longer than the Out string, the "extra" In
 
characters are associated with the Pad character.
<li>If the <var>In</var> string is longer than the <var>Out</var> string, the "extra" <var>In</var>
In this case, it is a request-canceling error if no Pad character is present.
characters are associated with the <var>Pad</var> character. In this case, it is a request-canceling error if no <var>Pad</var> character is present.
<li>The Out argument can be omitted, as long as a Pad argument is present.
 
The Pad argument has no default.
<li>The <var>Out</var> argument can be omitted, as long as a <var>Pad</var> argument is present.
<li>For an example of an <var>Update</var> call, see the [[CharacterMap class#Example|CharacterMap class]] page.
The <var>Pad</var> argument has no default.
 
<li>For an example of an <var>Update</var> call, see the [[CharacterMap class#Example|"CharacterMap class"]] page.
</ul>
</ul>
==See also==
==See also==
{{Template:CharacterMap:Update footer}}
{{Template:CharacterMap:Update footer}}

Latest revision as of 20:46, 14 November 2012

Update this CharacterMap (CharacterMap class)


The method lets you modify existing character associations or add new ones. The method's parameters and mapping rules are the same as the New method.

Syntax

characterMap:Update( In= string, [Out= string], [Pad= c])

Syntax terms

characterMap A CharacterMap object.
In A required, name required, argument that specifies the "input table" characters that you are adding or resetting. No character can be specified more than once in the In string, which may not be more than 256 characters.
Out An optional, name required, argument that specifies the "output table" characters. The Out string may not be longer than the In string; it may be shorter, however, as long as a Pad character is specified. The Out string may not be more than 256 characters.
Pad An optional, name required, argument that specifies the character used to pad the output table string on the right if it is shorter than the In string. Pad must be a single character, only.

Usage notes

  • Case is respected in all character specifications.
  • If an In string character you specify is already mapped in the method object, the existing mapping is modified by the association indicated in the Update call. If an In string character you specify is not already mapped, the association indicated in the Update call is added to the method object's mapping.
  • If the In string is longer than the Out string, the "extra" In characters are associated with the Pad character. In this case, it is a request-canceling error if no Pad character is present.
  • The Out argument can be omitted, as long as a Pad argument is present. The Pad argument has no default.
  • For an example of an Update call, see the "CharacterMap class" page.

See also