<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/1219/">https://reviewboard.asterisk.org/r/1219/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.orgrb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers, Russell Bryant and David Vossel.</div>
<div>By jrose.</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Adds a string replace function to func_strings.c as well as a test for said function.
This is a bit different from the requested patch, but should work to accomplish the same ends.
It doesn't use a variable name as one of the variables (unlike the user-submitted patch), so if you want to search from a variable, you have to specify it as one instead. I personally feel this is more flexible since this way you can get the searched on string in all kinds of ways.
I did discover that spaces in dialplan mess with stuff like this though. Just something to be aware of, if it'd be a good thing to add to documentation, let me know.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">As you'll see, there is an included test with a number of comment-described test scenarios.
Also, this is the dialplan I used for manual testing:
;strreplace test
exten => 3201,1,Answer()
exten => 3201,n,Echo(${STRREPLACE(,"dog","cat")})
exten => 3200,1,Answer()
exten => 3200,n,Echo(${STRREPLACE("I once knew a dog who owned a pet dog who had a pet dog which ate a dog and cooked a corn dog.", "dog", "cat", 4)})
exten => 3202,1,Answer()
exten => 3202,n,Echo(${STRREPLACE("I once knew a dog who owned a pet dog who had a pet dog which ate a dog and cooked a corn dog.", "dog", "cat", 2)})
exten => 3203,1,Answer()
exten => 3203,n,Echo(${STRREPLACE("I once knew a dog who owned a pet dog who had a pet dog which ate a dog and cooked a corn dog.", "dog", "cat", 10)})
exten => 3204,1,Answer()
exten => 3204,n,Echo(${STRREPLACE("I once knew a dog who owned a pet dog who had a pet dog which ate a dog and cooked a corn dog.", "dog", "elephant", 4)})
exten => 3205,1,Answer()
exten => 3205,n,Echo(${STRREPLACE("I once knew a elephant who owned a pet elephant who had a pet elephant which ate an elephant and cooked a corn elephant.", "elephant", "cat", 4)})
exten => 3206,1,Answer()
exten => 3206,n,Echo(${STRREPLACE("", "", "")});
exten => 3207,1,Answer()
exten => 3207,n,Echo(${STRREPLACE("I once knew a dog who owned a pet dog who had a pet dog which ate a dog and cooked a corn dog.", "dog", "cat")})
exten => 3208,1,Answer()
exten => 3208,n,Echo(${STRREPLACE("I once knew a dog who owned a pet dog who had a pet dog which ate a dog and cooked a corn dog.", "dog", ,4)})
exten => 3209,1,Answer()
exten => 3209,n,Echo(${STRREPLACE("I once knew a dog who owned a pet dog who had a pet dog which ate a dog and cooked a corn dog.",, "cat", 4)})
exten => 3210,1,Answer()
exten => 3210,n,Set( Cheese= BlahblHDFJK)
exten => 3211,1,Answer()
exten => 3211,n,Set(teststring="do re mi fa sa la ti do do mi fa re fa sal la ti do do do"
exten => 3211,n,Set(Chowder=${STRREPLACE(${teststring},"do","dodo")})
exten => 3211,n,Echo(Chowder = ${Chowder})
exten => 3212,1,Answer()
exten => 3212,n,Echo(${STRREPLACE("elephants have eaten my phone system.","elephants","Weasels")})
exten => 3213,1,Answer()
exten => 3213,n,Echo(${STRREPLACE("Wizards did it! They killed everyone!")})
exten => 3214,1,Answer()
exten => 3214,n,Echo(${STRREPLACE("This string needs something removed."," removed")})
So you'll see I tested it somewhat extensively.</pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://issues.asterisk.org/view.php?id=18023">18023</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/funcs/func_strings.c <span style="color: grey">(319115)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1219/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>