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
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">
20 font-family:
"Courier New";
24 <title>replace
</title>
26 <body bgcolor=
"#DAD3C5" vlink=
"#0094D2" link=
"#003258">
27 <table align=
"left" border=
"0" cellspacing=
"0" cellpadding=
"0" valign=top
>
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>
32 <table border=
"0" align=
"right" cellpadding=
"0" cellspacing=
"0">
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>
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>
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>
62 <hr align=
"left" width=
"50%">
65 <table border=
"0" width=
"90%" bgcolor=
"#FFB599" cellpadding=
"4">
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>
78 <hr align=
"left" width=
"25%">
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%">