# Format and replace the first letter of the string

**URL:** <https://community.glideapps.com/t/format-and-replace-the-first-letter-of-the-string/72441>\
**Category:** Ask for Help\
**Created:** [April 10, 2024, 1:20am UTC](https://community.glideapps.com/t/format-and-replace-the-first-letter-of-the-string/72441 "2024-04-10T01:20:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicklim](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nicklim/32/44360_2.png) [@nicklim](https://community.glideapps.com/u/nicklim)\
**Post date:** [April 10, 2024, 1:20am UTC](https://community.glideapps.com/t/format-and-replace-the-first-letter-of-the-string/72441/1 "2024-04-10T01:20:05Z")

</div>

Hi, I have a text column with special code like this A0574JACP, 00928TFM, TF4882JZF, 04300FJTT.

I want to replace the first 2 letters of the text with the 3 letters “BAR” in front (eg BAR574JACP, BAR928TFM, BAR4882JZF). If I use a template replacement method, it would replace the other similar in the string.

Hope anyone could help please. Thanks!

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [April 10, 2024, 1:41am UTC](https://community.glideapps.com/t/format-and-replace-the-first-letter-of-the-string/72441/2 "2024-04-10T01:41:08Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/3/83b4088fc1485e3e23e91aa0d31fae38bed47b8a.png)

You can do it like this.

```auto
return 'BAR' + p1.slice(2);

```

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [April 10, 2024, 3:00am UTC](https://community.glideapps.com/t/format-and-replace-the-first-letter-of-the-string/72441/3 "2024-04-10T03:00:47Z")

</div>

Using the [Replace All](https://www.glideapps.com/plugins/replace-all) plugin column:

 ![CleanShot 2024-04-10 at 10.59.02@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/b/0b1d2bb6d38ee790a9da726dcedb395411ffc63c.png)

---

<div class="post-metadata">

**Author:** ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)\
**Post date:** [April 10, 2024, 3:51am UTC](https://community.glideapps.com/t/format-and-replace-the-first-letter-of-the-string/72441/4 "2024-04-10T03:51:09Z")

</div>

Using AI:

 ![Screenshot 2024-04-10 at 10.48.44](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/1/f13e6506903fafe9fa15c1e694afbbb20e75b116.jpeg)

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [April 10, 2024, 3:06pm UTC](https://community.glideapps.com/t/format-and-replace-the-first-letter-of-the-string/72441/5 "2024-04-10T15:06:39Z")

</div>

1. Use a Text Slice column to slice the special code and remove the first 2 digits.
2. Use a Template column to prefix the sliced text with “BAR”.

 ![Screenshot 2024-04-10 at 17.03.53](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/c/7c57b1cbed5222d0588f9aea0624ac7b459af18b.png)
