| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
<html> |
| 15 |
<head> |
| 16 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 17 |
<meta http-equiv="Content-Language" content="en-us"> |
| 18 |
<style type="text/css"> |
| 19 |
.strong_ref { |
| 20 |
font-family: "Courier New"; |
| 21 |
font-weight: bold; |
| 22 |
} |
| 23 |
</style> |
| 24 |
<title>replace</title> |
| 25 |
</head> |
| 26 |
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258"> |
| 27 |
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top> |
| 28 |
<tr> |
| 29 |
<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> |
| 30 |
</tr> |
| 31 |
</table> |
| 32 |
<table border="0" align="right" cellpadding="0" cellspacing="0"> |
| 33 |
<tr> |
| 34 |
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td> |
| 35 |
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td> |
| 36 |
<td><a alt="previous" href="repeat.html"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> |
| 37 |
<td><a alt="next" href="reply.html"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td> |
| 38 |
</tr> |
| 39 |
</table> |
| 40 |
<p><br clear="all"> |
| 41 |
</p> |
| 42 |
<hr> |
| 43 |
<h1>replace</h1> |
| 44 |
<hr align="left" width="75%"> |
| 45 |
<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> |
| 46 |
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 |
| 47 |
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 |
| 48 |
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 |
| 49 |
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 |
| 50 |
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 |
| 51 |
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 |
| 52 |
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).) |
| 53 |
<hr align="left" width="50%"> |
| 54 |
<p>Related keyword:</p> |
| 55 |
<ul> |
| 56 |
<li><b><font face="Courier New" size="4" color="#003258"><a href="integer.html">integer</a></font></b></li> |
| 57 |
<li><b><font face="Courier New" size="4" color="#003258"><a href="charstring.html">charstring</a></font></b></li> |
| 58 |
<li><b><font face="Courier New" size="4" color="#003258"><a href="hexstring.html">hexstring</a></font></b></li> |
| 59 |
<li><b><font face="Courier New" size="4" color="#003258"><a href="bitstring.html">bitstring</a></font></b></li> |
| 60 |
<li><b><font face="Courier New" size="4" color="#003258"><a href="octetstring.html">octetstring</a></font></b></li> |
| 61 |
</ul> |
| 62 |
<hr align="left" width="50%"> |
| 63 |
<div align="center"> |
| 64 |
<center> |
| 65 |
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> |
| 66 |
<tr> |
| 67 |
<td width="100%"> |
| 68 |
<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, |
| 69 |
</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 |
| 70 |
any_string_or_sequence_type</b></font></h3> |
| 71 |
</td> |
| 72 |
</tr> |
| 73 |
</table> |
| 74 |
</center> |
| 75 |
</div> |
| 76 |
<ul> |
| 77 |
</ul> |
| 78 |
<hr align="left" width="25%"> |
| 79 |
<p>Example 1:</p> |
| 80 |
<p><font face="Courier New"> var charstring v_nyilatko := replace( "My name is JJ", 11, 1, "xx" ); </font></p> |
| 81 |
<p>The variable v_nyilatko will contain the charstring value "My name is xxJ". |
| 82 |
<hr align="left" width="25%"> |
| 83 |
</body> |
| 84 |
</html> |