# Web Client Quirk in StringReplace

**URL:** <https://forum.servoy.com/t/web-client-quirk-in-stringreplace/8190>\
**Category:** Classic Servoy\
**Created:** [October 1, 2007, 11:48am UTC](https://forum.servoy.com/t/web-client-quirk-in-stringreplace/8190 "2007-10-01T11:48:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpearce](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@dpearce](https://forum.servoy.com/u/dpearce)\
**Post date:** [October 1, 2007, 11:48am UTC](https://forum.servoy.com/t/web-client-quirk-in-stringreplace/8190/1 "2007-10-01T11:48:26Z")

</div>

I have found an interesting quirk in the web client (3.5.1) when using the StringReplace function.

I had a simple routine that replaced some variable text if it was there and it works fine in the normal smart client.

```auto
var initial=utils.stringReplace(rw_tr_initial,'{hospital}',rw_tr_hospital)

```

if rw\_tr\_initial didnt have the {hospital} in it in smart client it just gave you the rw\_tr\_initial back.

in webclient this doesnt work. it just deletes the whole line and gives you nothing back in var initial.

The workaround is to do a pattern count first and dont do the replace if you dont find the pattern, just make the variable equal to the field.

Just one of those quirky things, i though i would let others know in case they are bangin their head against the desk with similar code.

David

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [October 1, 2007, 1:08pm UTC](https://forum.servoy.com/t/web-client-quirk-in-stringreplace/8190/2 "2007-10-01T13:08:35Z")

</div>

That doesn’t sound like it’s working correctly.

Can you report this in the Support System?

There should not be the need to create workarounds for something like that.

Paul
