# Replace text in string

**URL:** <https://community.thunkable.com/t/replace-text-in-string/16476>\
**Category:** Questions about Thunkable X\
**Tags:** components\
**Created:** [February 8, 2018, 5:52am UTC](https://community.thunkable.com/t/replace-text-in-string/16476 "2018-02-08T05:52:22Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)\
**Post date:** [February 8, 2018, 5:52am UTC](https://community.thunkable.com/t/replace-text-in-string/16476/1 "2018-02-08T05:52:22Z")

</div>

Hello,

I made a a replace text block (okay, actually its 25 blocks size)

 ![Screenshot from 2018-02-08 06-39-12](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/2X/1/197f9bf2cd40c9639ccf8047de470ba10e3e124f.png)

If anybody has a better suggestion, let me know! 😃

cheers,  
User81

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [February 8, 2018, 10:41am UTC](https://community.thunkable.com/t/replace-text-in-string/16476/2 "2018-02-08T10:41:46Z")

</div>

Can you just use a space as the delimiter??

---

<div class="post-metadata">

**Author:** ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)\
**Post date:** [February 8, 2018, 12:29pm UTC](https://community.thunkable.com/t/replace-text-in-string/16476/3 "2018-02-08T12:29:04Z")

</div>

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”)

 ![Screenshot from 2018-02-08 13-16-18](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/2X/c/c13313b20afa068bd1915c7c62884bc18faa5812.png)

---

<div class="post-metadata">

**Author:** ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)\
**Post date:** [April 9, 2018, 6:50pm UTC](https://community.thunkable.com/t/replace-text-in-string/16476/4 "2018-04-09T18:50:58Z")

</div>

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!!!

 ![Screenshot from 2018-04-09 21-43-26](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/9/c9a46f32a36ed5ecd7e58210fa2705e9c389ac04.png)

---

<div class="post-metadata">

**Author:** ![ervarela](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ervarela/32/17136_2.png) [@ervarela](https://community.thunkable.com/u/ervarela)\
**Post date:** [April 9, 2018, 7:25pm UTC](https://community.thunkable.com/t/replace-text-in-string/16476/5 "2018-04-09T19:25:27Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)\
**Post date:** [April 9, 2018, 7:38pm UTC](https://community.thunkable.com/t/replace-text-in-string/16476/6 "2018-04-09T19:38:41Z")

</div>

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 😆)

---

<div class="post-metadata">

**Author:** ![indian](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/indian/32/11311_2.png) [@indian](https://community.thunkable.com/u/indian)\
**Post date:** [April 12, 2018, 9:34am UTC](https://community.thunkable.com/t/replace-text-in-string/16476/7 "2018-04-12T09:34:10Z")

</div>

What version of thunkable is this?/ Why the block colours ar different from thunkable?

---

<div class="post-metadata">

**Author:** ![User81](https://avatars.discourse-cdn.com/v4/letter/u/ba9def/32.png) [@User81](https://community.thunkable.com/u/User81)\
**Post date:** [April 12, 2018, 9:41am UTC](https://community.thunkable.com/t/replace-text-in-string/16476/8 "2018-04-12T09:41:54Z")

</div>

1. iOS.thunkable
2. Maybe because of my Image Processing software

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [May 5, 2020, 5:57am UTC](https://community.thunkable.com/t/replace-text-in-string/16476/9 "2020-05-05T05:57:20Z")

</div>

Can you share a link to this?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [May 5, 2020, 2:00pm UTC](https://community.thunkable.com/t/replace-text-in-string/16476/10 "2020-05-05T14:00:16Z")

</div>

Hi @overshield, what kind of code snippet are you looking for?

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [May 6, 2020, 8:44pm UTC](https://community.thunkable.com/t/replace-text-in-string/16476/11 "2020-05-06T20:44:17Z")

</div>

I’m wondering what is powering the function.  
Like what does the OP have in this screenshot

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/5/35f18ca6475a0507ba8a977af4be2deac2c997c1.png)

Here’s what I have currently

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/4/9449a36804bc340d0c878138a29b568fa304e48e.png)

Thanks again guys for the help

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [May 6, 2020, 9:08pm UTC](https://community.thunkable.com/t/replace-text-in-string/16476/12 "2020-05-06T21:08:35Z")

</div>

Oh boy. Not sure. What are you trying to accomplish?

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [May 7, 2020, 12:02am UTC](https://community.thunkable.com/t/replace-text-in-string/16476/13 "2020-05-07T00:02:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [May 7, 2020, 12:37am UTC](https://community.thunkable.com/t/replace-text-in-string/16476/14 "2020-05-07T00:37:00Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![whoisbhaujiqo5wf](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/whoisbhaujiqo5wf/32/47143_2.png) [@whoisbhaujiqo5wf](https://community.thunkable.com/u/whoisbhaujiqo5wf)\
**Post date:** [April 22, 2021, 6:00am UTC](https://community.thunkable.com/t/replace-text-in-string/16476/15 "2021-04-22T06:00:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jane](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jane/32/27575_2.png) [@jane](https://community.thunkable.com/u/jane)\
**Post date:** [April 22, 2021, 7:25am UTC](https://community.thunkable.com/t/replace-text-in-string/16476/16 "2021-04-22T07:25:52Z")

</div>

Hi there,

We have made some updates since this post was first made in 2018 - we now have a [replace text](https://docs.thunkable.com/text#replace-all) 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]](https://docs.thunkable.com/text#get-substring)  
insert my new [string](https://docs.thunkable.com/text#string)  
[get substring from #[y+1] to last character](https://docs.thunkable.com/text#get-substring)  
[join](https://docs.thunkable.com/text#join) these together

---

<div class="post-metadata">

**Author:** ![whoisbhaujiqo5wf](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/whoisbhaujiqo5wf/32/47143_2.png) [@whoisbhaujiqo5wf](https://community.thunkable.com/u/whoisbhaujiqo5wf)\
**Post date:** [April 22, 2021, 8:00am UTC](https://community.thunkable.com/t/replace-text-in-string/16476/17 "2021-04-22T08:00:57Z")

</div>

Ah yes, of course - Brilliant. Gonna use this.  
Thx, Jane!

---

<div class="post-metadata">

**Author:** ![royrosemarin](https://avatars.discourse-cdn.com/v4/letter/r/a9adbd/32.png) [@royrosemarin](https://community.thunkable.com/u/royrosemarin)\
**Post date:** [May 8, 2021, 3:29pm UTC](https://community.thunkable.com/t/replace-text-in-string/16476/18 "2021-05-08T15:29:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:29am UTC](https://community.thunkable.com/t/replace-text-in-string/16476/19 "2024-11-08T11:29:24Z")

</div>


