Hello,
I made a a replace text block (okay, actually its 25 blocks size)
If anybody has a better suggestion, let me know!
cheers,
User81
Hello,
I made a a replace text block (okay, actually its 25 blocks size)
If anybody has a better suggestion, let me know!
cheers,
User81
Can you just use a space as the delimiter??
I can replace every character or string I want…
I just put the string into the variable “replaceString” and right after that I start the function “do something” with the result “replaceString” (for example: label.text=“do something”)
actually its a lot easier.
just build your own replace string/character or remove string/character function.
Thx to the thunkable developers for making the functions so reliable in the recent update!!!
This is really neat. If you don’t mind my asking, what’s the use case? I’m interested in how you’re applying this, or what your app does (helps me get ideas on how to improve my own work).
Hi ervarela,
thank you for your interest. My app is all about sharing text and pictures to each other - and therefore uses the realtime database (firebase) .
firebase does not like a few characters, so I want to make sure to remove or replace these viciuos characters before sending a textstring to the firebase.
another usecase would be to replace characters to make a URL code.
(thunkable android has these blocks by default, so I did not really invent them )
What version of thunkable is this?/ Why the block colours ar different from thunkable?
Can you share a link to this?
Thanks in advance
Hi @overshield, what kind of code snippet are you looking for?
I’m wondering what is powering the function.
Like what does the OP have in this screenshot
Here’s what I have currently
Thanks again guys for the help
Oh boy. Not sure. What are you trying to accomplish?
I’d like to enter a long string of text and be able to replace certain keywords with other words.
I basically need what the OP apparently has created.
I recently learned to make a ‘linter‘ in JavaScript. I like the idea of making that here. If I get the time, I will make this!
Hi User81
Found this quite useful but i have a slightly different use case. I want to replace a character at an index with another character. so the delimiter is actually an index, not a character.
Any ideas?
Thanks
Ravi
Hi there,
We have made some updates since this post was first made in 2018 - we now have a replace text block!
You can replace a given character (or characters) in the following way (Imagine I’m replacing the characters between #x and #y):
get substring from #1 to #[x-1]
insert my new string
get substring from #[y+1] to last character
join these together
Ah yes, of course - Brilliant. Gonna use this.
Thx, Jane!
Was just searching for this now. It’s a cool solution. It will be useful if you can wrap it as a new function to replace substrings between given indices.