Commit | Line | Data |
---|---|---|
970ed795 | 1 | <!-- |
3abe9331 | 2 | Copyright (c) 2000-2015 Ericsson Telecom AB |
970ed795 EL |
3 | |
4 | All rights reserved. This program and the accompanying materials | |
5 | are made available under the terms of the Eclipse Public License v1.0 | |
6 | which accompanies this distribution, and is available at | |
7 | http://www.eclipse.org/legal/epl-v10.html | |
8 | --> | |
9 | <html> | |
10 | <head> | |
11 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
12 | <meta http-equiv="Content-Language" content="en-us"> | |
13 | <style type="text/css"> | |
14 | .strong_ref { | |
15 | font-family: "Courier New"; | |
16 | font-weight: bold; | |
17 | } | |
18 | </style> | |
19 | <title>replace</title> | |
20 | </head> | |
21 | <body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258"> | |
22 | <table align="left" border="0" cellspacing="0" cellpadding="0" valign=top> | |
23 | <tr> | |
24 | <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> | |
25 | </tr> | |
26 | </table> | |
27 | <table border="0" align="right" cellpadding="0" cellspacing="0"> | |
28 | <tr> | |
29 | <td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td> | |
30 | <td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td> | |
31 | <td><a alt="previous" href="repeat.html"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> | |
32 | <td><a alt="next" href="reply.html"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td> | |
33 | </tr> | |
34 | </table> | |
35 | <p><br clear="all"> | |
36 | </p> | |
37 | <hr> | |
38 | <h1>replace</h1> | |
39 | <hr align="left" width="75%"> | |
40 | <p>This function replaces the substring or subsequence of value/template <span class="strong_ref">inpar</span> at index <span class="strong_ref">index</span> of length <span class="strong_ref">len</span> | |
41 | with the string or sequence value/template <span class="strong_ref">repl</span> and returns the resulting string or sequence. <span class="strong_ref">inpar</span> shall not be modified. If <span | |
42 | class="strong_ref">len</span> is <span class="strong_ref">0</span> the string or sequence <span class="strong_ref">repl</span> is inserted. If <span class="strong_ref">index</span> is <span | |
43 | class="strong_ref">0</span>, <span class="strong_ref">repl</span> is inserted at the beginning of <span class="strong_ref">inpar</span>. If <span class="strong_ref">index</span> is <span | |
44 | class="strong_ref">lengthof(inpar)</span>, <span class="strong_ref">repl</span> is inserted at the end of <span class="strong_ref">inpar</span>. <span class="strong_ref">inpar</span> and <span | |
45 | class="strong_ref">repl</span>, and the returned string or sequence shall be of the same root type. The function replace can be applied to <span class="strong_ref">bitstring</span>, <span | |
46 | class="strong_ref">hexstring</span>, <span class="strong_ref">octetstring</span>, or any character string, <span class="strong_ref">record of</span>, <span class="strong_ref">set of</span>, or <span | |
47 | class="strong_ref">array</span>. Note that the indexing in strings starts from zero. (For more information check ETSI ES 201 873-1 (TTCN-3 Core Language).) | |
48 | <hr align="left" width="50%"> | |
49 | <p>Related keyword:</p> | |
50 | <ul> | |
51 | <li><b><font face="Courier New" size="4" color="#003258"><a href="integer.html">integer</a></font></b></li> | |
52 | <li><b><font face="Courier New" size="4" color="#003258"><a href="charstring.html">charstring</a></font></b></li> | |
53 | <li><b><font face="Courier New" size="4" color="#003258"><a href="hexstring.html">hexstring</a></font></b></li> | |
54 | <li><b><font face="Courier New" size="4" color="#003258"><a href="bitstring.html">bitstring</a></font></b></li> | |
55 | <li><b><font face="Courier New" size="4" color="#003258"><a href="octetstring.html">octetstring</a></font></b></li> | |
56 | </ul> | |
57 | <hr align="left" width="50%"> | |
58 | <div align="center"> | |
59 | <center> | |
60 | <table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> | |
61 | <tr> | |
62 | <td width="100%"> | |
63 | <h3 align="center"><font face="Courier New" color="#003258" size="5"><b>replace</b></font> <font face="Courier New" color="#003258" size="5"><b>(</b></font>in any_string_or_sequence_type <i>inpar, | |
64 | </i><b>in integer</b><i> index, </i><b>in integer</b><i> len, </i><b>in any_string_or_sequence_type <i>repl</i><font face="Courier New" color="#003258" size="5"><b>) return | |
65 | any_string_or_sequence_type</b></font></h3> | |
66 | </td> | |
67 | </tr> | |
68 | </table> | |
69 | </center> | |
70 | </div> | |
71 | <ul> | |
72 | </ul> | |
73 | <hr align="left" width="25%"> | |
74 | <p>Example 1:</p> | |
75 | <p><font face="Courier New"> var charstring v_nyilatko := replace( "My name is JJ", 11, 1, "xx" ); </font></p> | |
76 | <p>The variable v_nyilatko will contain the charstring value "My name is xxJ". | |
77 | <hr align="left" width="25%"> | |
78 | </body> | |
79 | </html> |