It would be really cool if there was a function to manipulate text with string replacement similar to javascript’s text replace (JavaScript String replace() Method)
you know you can literally use that when you bind values right? yourWewebTextVariable.replace("hello","world")
That’s really cool, dorilama! Do you know if there is a way to replace all occurrences at once? Because this way, only the first occurrence found is replaced, from left to right. I would then have to chain together multiple ".replace"s to replace multiple occurrences of a string.
@dorilama I tried to replace special characters in a string with the Javascript method .replace(). However, it does not seem to work in the WeWeb editor - any idea what’s the issue here?
maybe post the code here (remember you need to wrap it in three backtiks ` so that the post show it correctly. You also may want to use reppaceAll or replace with a regular expression with a global flag otherwise you are just replacing the first occurence in the string
I tried it with .replaceAll and with regex - both didn’ work either. Since the code works in the console, I assume there is a bug in the WeWeb editor?!
Here’s the code:
string = string.replace("Ö", "O").replace("ö", "o").replace("Ü", "U").replace("ü", "u").replace("Ä", "A").replace("ä", "a");
return string
the code looks all right, maybe try reporting a bug on this from the resource center in the editor
Hey there,
On my end, and in the meantime, in order to achieve the “replace” in nocode formula (instead of Javascript), I’ve used “join” in combination with “split”.
For example
join(split(string,“i”),“o”) => resulting in “strong”
Hope this helps anyone struggling with this.