2 Copyright (c) 2000-2016 Ericsson Telecom AB
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Eclipse Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/epl-v10.html
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>
22 <body bgcolor=
"#DAD3C5" vlink=
"#0094D2" link=
"#003258">
23 <table align=
"left" border=
"0" cellspacing=
"0" cellpadding=
"0" valign=top
>
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>
28 <table border=
"0" align=
"right" cellpadding=
"0" cellspacing=
"0">
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>
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,
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>
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>
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 â
\80¦
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>
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>
67 <p>Related keywords:
</p>
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>
79 <hr align=
"left" width=
"50%">
82 <table border=
"0" width=
"90%" bgcolor=
"#FFB599" cellpadding=
"4">
85 <h3 align=
"center"><font face=
"Courier New" color=
"#003258" size=
"5"><b>universal charstring
</b></font></h3>
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>
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>
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>
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>
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
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>
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>
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>
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>
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>
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>
139 <p>The constant called c_siffra will have the integer value
2 147 483 647.
</p>
140 <hr align=
"left" width=
"50%">
142 <p><a name=
"lengthof">Example
7c
</a>:
143 <p><font face=
"Courier New">const integer c_longeur := lengthof(c_kordo);
<br>
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(
"Ã
\84Ã
\96Ã
\9cäöü
");
<br>
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>
155 <p>The constant called c_ustr will have the value
"Ã
\84Ã
\96Ã
\9cäöü
"</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>
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>
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>
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%">