| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
<html> |
| 17 |
<head> |
| 18 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 19 |
<meta http-equiv="Content-Language" content="en-us"> |
| 20 |
<title>universal</title> |
| 21 |
</head> |
| 22 |
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258"> |
| 23 |
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top> |
| 24 |
<tr> |
| 25 |
<td width=105 height=40><a href="https://projects.eclipse.org/projects/tools.titan"><img src="../images/titan_transparent.gif" border=0 width=105 height=40 align="left" alt="Titan"></a></td> |
| 26 |
</tr> |
| 27 |
</table> |
| 28 |
<table border="0" align="right" cellpadding="0" cellspacing="0"> |
| 29 |
<tr> |
| 30 |
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td> |
| 31 |
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td> |
| 32 |
<td><a alt="previous" href="union.html"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> |
| 33 |
<td><a href="unmap.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td> |
| 34 |
</tr> |
| 35 |
</table> |
| 36 |
<p><br clear="all"> |
| 37 |
</p> |
| 38 |
<hr> |
| 39 |
<h1>universal</h1> |
| 40 |
<hr align="left" width="75%"> |
| 41 |
<p><font face="Courier New"><b>universal</b></font> can only be used together with the keyword <font face="Courier New"><a href="charstring.html"><b>charstring</b></a></font> forming a single, |
| 42 |
composed keyword.</p> |
| 43 |
<p>The keyword <b><font face="Courier New">universal charstring</font></b> denotes a basic string type whose distinguished values are zero, one, or more characters from <a |
| 44 |
href="http://www.unicode.org/charts/" target="_blank">ISO/IEC 10646</a>.</p> |
| 45 |
<ul> |
| 46 |
<li>Character string values are written between <a href="#double_quotation"> double quotes</a> (" ").</li> |
| 47 |
<li>A single universal character may be specified by its decimal code point using a <a href="#conversion">conversion function</a>..</li> |
| 48 |
<li>Another notation used for universal character strings is the quadruple form. (Cf. the keyword <b><font face="Courier New"><a href="char.html">char</a></font></b>)</li> |
| 49 |
<li>A <a href="#quotation_inside"> double quote inside character string</a> is represented by a pair of double quotes with no intervening space.</li> |
| 50 |
<li>The <a href="#relation">relational operators</a> equality (==) and non-equality (!=) can be used to compare values of two character strings</li> |
| 51 |
<li>The <a href="#rotate">rotate operators</a> perform the rotate left (<@) and rotate right (@>) operations.</li> |
| 52 |
<li>The <a href="#concatenation"> concatenation operator</a> (&) performs a simple concatenation from left to right.</li> |
| 53 |
<li>A <a href="#array"> single character</a> may be accessed using an array-like syntax. The leftmost character has the index zero.</li> |
| 54 |
<li>The character string may be <a href="#vacuum">empty</a>.</li> |
| 55 |
<li>Predefined functions operating on universal character strings:</li> |
| 56 |
<ul> |
| 57 |
<li><a href="#uchar2oct">unichar2oct</a> converts an <b><font face="Courier New">universal charstring</font></b> to an octet string.</li> |
| 58 |
<li><a href="#oct2uchar">oct2unichar</a> converts an octet string as an <b><font face="Courier New">universal charstring</font></b>.</li> |
| 59 |
<li><a href="#char2char">unichar2char</a> converts a single-character-length <b><font face="Courier New">universal charstring</font></b> into a charstring value.</li> |
| 60 |
<li><a href="#char2int">unichar2int</a> converts a single-character-length <b><font face="Courier New">universal charstring</font></b> into an integer value in the range of 0 ⦠2 147 483 647. The integer value describes the 32-bit encoding of the character.</li> |
| 61 |
<li><a href="#lengthof">lengthof</a> returns an integer value indicating the number of characters in a string.</li> |
| 62 |
</ul> |
| 63 |
<li>The length of the universal character string can be constrained using the keyword <a href="length.html"><b><font face="Courier New" color="#003258" size="4">length</font></b></a>.</li> |
| 64 |
<li>The <a href="#range">range of the permitted characters</a> may be specified.</li> |
| 65 |
<li>Another way to limit the permitted values of a universal character string is <a href="#list">to list them</a>.</li> |
| 66 |
</ul> |
| 67 |
<p>Related keywords:</p> |
| 68 |
<ul> |
| 69 |
<li><a href="char.html"><b><font face="Courier New" color="#003258" size="4">char</font></b></a></li> |
| 70 |
<li><a href="charstring.html"><b><font face="Courier New" color="#003258" size="4">charstring</font></b></a></li> |
| 71 |
<li><a href="int2unichar.html"><b><font face="Courier New" color="#003258" size="4">int2unichar</font></b></a></li> |
| 72 |
<li><a href="length.html"><b><font face="Courier New" color="#003258" size="4">length</font></b></a></li> |
| 73 |
<li><a href="lengthof.html"><b><font face="Courier New" color="#003258" size="4">lengthof</font></b></a></li> |
| 74 |
<li><a href="unichar2char.html"><b><font face="Courier New" color="#003258" size="4">unichar2char</font></b></a></li> |
| 75 |
<li><a href="unichar2int.html"><b><font face="Courier New" color="#003258" size="4">unichar2int</font></b></a></li> |
| 76 |
<li><a href="unichar2oct.html"><b><font face="Courier New" color="#003258" size="4">unichar2oct</font></b></a></li> |
| 77 |
<li><a href="oct2unichar.html"><b><font face="Courier New" color="#003258" size="4">oct2unichar</font></b></a></li> |
| 78 |
</ul> |
| 79 |
<hr align="left" width="50%"> |
| 80 |
<div align="center"> |
| 81 |
<center> |
| 82 |
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> |
| 83 |
<tr> |
| 84 |
<td width="100%"> |
| 85 |
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>universal charstring</b></font></h3> |
| 86 |
</td> |
| 87 |
</tr> |
| 88 |
</table> |
| 89 |
</center> |
| 90 |
</div> |
| 91 |
<hr align="left" width="50%"> |
| 92 |
<p><a name="double_quotation">Example 1</a>: |
| 93 |
<p><font face="Courier New">const universal charstring c_kordo := "ĉirkaŭĵo";<br> |
| 94 |
</font> |
| 95 |
<p>The constant defined is called c_kordo and has the value ĉirkaŭĵo</p> |
| 96 |
<hr align="left" width="50%"> |
| 97 |
<p><a name="conversion">Example 1a</a>: |
| 98 |
<p><font face="Courier New">const universal charstring c_ukrouzek := int2unichar (367);<br> |
| 99 |
</font> |
| 100 |
<p>The constant called c_ukrouzek will contain the Czech letter ů</p> |
| 101 |
<hr align="left" width="50%"> |
| 102 |
<p><a name="quotation_inside">Example 2</a>: |
| 103 |
<p><font face="Courier New">const universal charstring c_leet := "être:""";<br> |
| 104 |
</font> |
| 105 |
<p>The constant defined is called c_leet and has the value être:"</p> |
| 106 |
<hr align="left" width="50%"> |
| 107 |
<p><a name="relation">Example 3</a>: |
| 108 |
<p><font face="Courier New">const boolean c_baade := ( c_kordo == c_leet );<br> |
| 109 |
</font> |
| 110 |
<p>The constant c_baade will have the value false, because two character strings are equal only if they have equal lengths and the characters at all positions are the same. The parantheses |
| 111 |
are optional.</p> |
| 112 |
<hr align="left" width="50%"> |
| 113 |
<p><a name="concatenation">Example 4</a>: |
| 114 |
<p><font face="Courier New">const charstring c_gluo := c_kordo & c_ukrouzek & c_ukrouzek & c_ukrouzek;<br> |
| 115 |
</font> |
| 116 |
<p>The constant c_gluo will contain the string ĉirkaŭĵoůůů</p> |
| 117 |
<hr align="left" width="50%"> |
| 118 |
<p><a name="array">Example 5</a>: |
| 119 |
<p><font face="Courier New">const universal charstring c_circonflex := c_leet[0];<br> |
| 120 |
</font> |
| 121 |
<p>The constant called c_circonflex will contain a single element with the value ê.</p> |
| 122 |
<hr align="left" width="50%"> |
| 123 |
<p><a name="vacuum">Example 6</a>: |
| 124 |
<p><font face="Courier New">const universal charstring c_vakuo := "";<br> |
| 125 |
</font> |
| 126 |
<p>The constant called c_vakuo will be an empty string.</p> |
| 127 |
<hr align="left" width="50%"> |
| 128 |
<p><a name="char2char">Example 7a</a>: |
| 129 |
<p><font face="Courier New">const charstring c_siffra := unichar2char(char(0,0,0,64));<br> |
| 130 |
</font> |
| 131 |
<p>The constant called c_siffra will have the charstring value "@".</p> |
| 132 |
<hr align="left" width="50%"> |
| 133 |
<p><a name="char2int">Example 7b</a>: |
| 134 |
<p><font face="Courier New">const integer c_siffra := unichar2int("é");<br> |
| 135 |
</font> |
| 136 |
<p>The constant called c_siffra will have the integer value 130.</p> |
| 137 |
<p><font face="Courier New">const integer c_siffra1 := unichar2int(char(127,255,255,255));<br> |
| 138 |
</font> |
| 139 |
<p>The constant called c_siffra will have the integer value 2 147 483 647.</p> |
| 140 |
<hr align="left" width="50%"> |
| 141 |
|
| 142 |
<p><a name="lengthof">Example 7c</a>: |
| 143 |
<p><font face="Courier New">const integer c_longeur := lengthof(c_kordo);<br> |
| 144 |
</font> |
| 145 |
<p>The constant called c_longeur will have the value 8 corresponding to the number of characters in the string .</p> |
| 146 |
<hr align="left" width="50%"> |
| 147 |
<p><a name="uchar2oct">Example 7d</a>: |
| 148 |
<p><font face="Courier New">const integer c_ostr := unichar2oct("ÃÃÃäöü");<br> |
| 149 |
</font> |
| 150 |
<p>The constant called c_ostr will have the value 'EFBBBFC384C396C39CC3A4C3B6C3BC'O.</p> |
| 151 |
<hr align="left" width="50%"> |
| 152 |
<p><a name="oct2uchar">Example 7e</a>: |
| 153 |
<p><font face="Courier New">const integer c_ustr := oct2unichar('C384C396C39CC3A4C3B6C3BC'O);<br> |
| 154 |
</font> |
| 155 |
<p>The constant called c_ustr will have the value "ÃÃÃäöü"</p> |
| 156 |
<hr align="left" width="50%"> |
| 157 |
<p><a name="list">Example 8</a>: |
| 158 |
<p><font face="Courier New">var universal charstring c_een(char(0,0,0,129));<br> |
| 159 |
</font> |
| 160 |
<p>The variable called c_een may hold only the character "ü".</p> |
| 161 |
<hr align="left" width="50%"> |
| 162 |
<p><a name="rotate">Example 9</a>: </p> |
| 163 |
<p><font face="Courier New">const universal charstring c_merry := "ábcdéfg" <@ 3;<br> |
| 164 |
</font> |
| 165 |
<p>The constant called c_merry will hold the value"défgábc" (the left operand rotated by three characters) . </p> |
| 166 |
<hr align="left" width="50%"> |
| 167 |
<p><a name="range">Example 10</a>: |
| 168 |
<p><font face="Courier New">var universal charstring v_spannung((char(0, 0, 0, 67) .. char(0, 0, 0, 69));<br> |
| 169 |
</font> |
| 170 |
<p>The variable v_spannung may have the following values: "c", "d", "e".</p> |
| 171 |
<hr align="left" width="25%"> |
| 172 |
<p align="left"><a HREF="BNF.html#universalkeyword">BNF definition</a> of <font face="Courier New">universal</font><br> |
| 173 |
<a HREF="BNF.html#charstringvalue">BNF definition</a> of universal charstring value</p> |
| 174 |
<hr align="left" width="25%"> |
| 175 |
</body> |
| 176 |
</html> |