New (CharacterToUnicodeMap constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
(Automatically generated page update)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:CharacterToUnicodeMap:New subtitle}}
{{Template:CharacterToUnicodeMap:New subtitle}}


This page is [[under construction]].
The <var>CharacterToUnicodeMap</var> object created by <var>New</var> is a mapping that associates the individual
characters from an "In" string argument with the <var>Unicode</var> characters
in the corresponding position in an "Out" string argument.
 
==Syntax==
==Syntax==
{{Template:CharacterToUnicodeMap:New syntax}}
{{Template:CharacterToUnicodeMap:New syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%outCharacterToUnicodeMap</th><td>A <var>CharacterToUnicodeMap</var> object.</td></tr>
<tr><th nowrap>%outCharacterToUnicodeMap</th><td>A <var>CharacterToUnicodeMap</var> object.</td></tr>
<tr><th nowrap="true"><var>%(CharacterToUnicodeMap)</var></th>
 
<tr><th><var class="nobr">%(CharacterToUnicodeMap)</var></th>
<td>The optional class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See [[#Usage notes|"Usage notes"]], below, for more information about invoking a <var>CharacterToUnicodeMap</var> <var>Constructor</var>.</td></tr>
<td>The optional class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>. See [[#Usage notes|"Usage notes"]], below, for more information about invoking a <var>CharacterToUnicodeMap</var> <var>Constructor</var>.</td></tr>
<tr><th><var>In</var></th>
<tr><th><var>In</var></th>
<td>An optional, [[Notation conventions for methods#Named parameters|name required]], <var>String</var> that specifies the single-byte character code points to be mapped to their <var>Unicode</var translation characters in the <var>Out</var> argument.
<td>An optional, [[Notation conventions for methods#Named parameters|name required]], <var>String</var> or <var>Longstring</var> that specifies the single-byte character code points to be mapped to <var>Unicode</var> characters in the corresponding position in the <var>Out</var> argument string.
No character duplications are allowed in the In string, which may not be more than 256 characters.</td></tr>
</td></tr>
 
<tr><th><var>Out</var></th>
<tr><th><var>Out</var></th>
<td>An optional, name required, <var>Unicode</var> string, each of whose characters is mapped to the character in the <var>In</var> string that occupies the same relative position in the string.
<td>An optional, name required, <var>Unicode</var> string, each of whose characters is mapped to the character in the <var>In</var> string that occupies the same relative position in the string.
The <var>Out</var> string may not be longer than the <var>In</var>; it may be shorter, however, as long as a <var>Pad</var> character is specified. <var>Out</var> may not contain more than 256 characters.</td></tr>
The <var>Out</var> string may not be longer than the <var>In</var>; it may be shorter, however, as long as a <var>Pad</var> character is specified. </td></tr>
 
<tr><th><var>Pad</var></th>
<tr><th><var>Pad</var></th>
<td>An optional, name required, <var>Unicode</var> string argument that specifies the character(s) used to pad the <var>Out</var> string on the right if it is shorter than <var>In</var>.
<td>An optional, name required, <var>Unicode</var> string argument that specifies the character(s) used to pad the <var>Out</var> string on the right if it is shorter than <var>In</var>.
Line 22: Line 29:
==Usage notes==
==Usage notes==
<ul>
<ul>
<li>Issuing <var>New</var> with no parameters produces a map where every single-byte code point is invalid.   
You probably would do this only if you are subsequently going to build up the map incrementally     
using the <var>[[Update (CharacterToUnicodeMap subroutine)|Update]]</var> method.
<li>As described in [[Object variables#Using New or other Constructors|"Using New or other Constructors"]], <var>New</var> can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is <var>Null</var>:<p class="code">%charToUniMap = new
<li>As described in [[Object variables#Using New or other Constructors|"Using New or other Constructors"]], <var>New</var> can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is <var>Null</var>:<p class="code">%charToUniMap = new


Line 29: Line 39:
</p>
</p>
</ul>
</ul>
==Examples==
See [[CharacterToUnicodeMap class#Example|"Example"]].


==See also==
==See also==
{{Template:CharacterToUnicodeMap:New footer}}
{{Template:CharacterToUnicodeMap:New footer}}

Latest revision as of 00:59, 16 February 2014

Create CharacterToUnicodeMap object (CharacterToUnicodeMap class)

[Introduced in Sirius Mods 8.0]


The CharacterToUnicodeMap object created by New is a mapping that associates the individual characters from an "In" string argument with the Unicode characters in the corresponding position in an "Out" string argument.

Syntax

%characterToUnicodeMap = [%(CharacterToUnicodeMap):]New[( [In= string], - [Out= unicode], [Pad= unicode])]

Syntax terms

%outCharacterToUnicodeMapA CharacterToUnicodeMap object.
%(CharacterToUnicodeMap) The optional class name in parentheses denotes a Constructor. See "Usage notes", below, for more information about invoking a CharacterToUnicodeMap Constructor.
In An optional, name required, String or Longstring that specifies the single-byte character code points to be mapped to Unicode characters in the corresponding position in the Out argument string.
Out An optional, name required, Unicode string, each of whose characters is mapped to the character in the In string that occupies the same relative position in the string. The Out string may not be longer than the In; it may be shorter, however, as long as a Pad character is specified.
Pad An optional, name required, Unicode string argument that specifies the character(s) used to pad the Out string on the right if it is shorter than In.

Usage notes

  • Issuing New with no parameters produces a map where every single-byte code point is invalid. You probably would do this only if you are subsequently going to build up the map incrementally using the Update method.
  • As described in "Using New or other Constructors", New can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is Null:

    %charToUniMap = new %charToUniMap = %(CharacterToUnicodeMap):new %charToUniMap = %charToUniMap:new

Examples

See "Example".

See also