# Insert number after second character

**URL:** <https://community.n8n.io/t/insert-number-after-second-character/3842>\
**Category:** Questions\
**Created:** [January 16, 2021, 4:53pm UTC](https://community.n8n.io/t/insert-number-after-second-character/3842 "2021-01-16T16:53:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LEONARDO\_SANTOS](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/leonardo_santos/32/2337_2.png) [@LEONARDO\_SANTOS](https://community.n8n.io/u/LEONARDO_SANTOS)\
**Post date:** [January 16, 2021, 4:53pm UTC](https://community.n8n.io/t/insert-number-after-second-character/3842/1 "2021-01-16T16:53:31Z")

</div>

I will receive a phone via json “4788289126”

I wanted a function that will identify that it is only 10 characters long and will insert a number 9 after the second character.  
“47988289126”

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [January 16, 2021, 5:40pm UTC](https://community.n8n.io/t/insert-number-after-second-character/3842/2 "2021-01-16T17:40:27Z")

</div>

Your question sounds incomplete. You say that it should identify that it is only 10 characters long. What is supposed to happen if it is shorter or longer?

---

<div class="post-metadata">

**Author:** ![LEONARDO\_SANTOS](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/leonardo_santos/32/2337_2.png) [@LEONARDO\_SANTOS](https://community.n8n.io/u/LEONARDO_SANTOS)\
**Post date:** [January 16, 2021, 8:45pm UTC](https://community.n8n.io/t/insert-number-after-second-character/3842/3 "2021-01-16T20:45:01Z")

</div>

I managed to give a solution, but I appreciate your return

api automatically takes the number it will always come with 10 characters

I made this code there that worked perfectly

```auto
const nome = $item(0).$json["body"]["phone"];
let primeiraparte = nome.substr(0, 4);
let segundaparte = nome.substr(4,13);
//554788289126
let coloca9 = primeiraparte+9;
let numerocom9 = coloca9+segundaparte;
return [{json:{numerocom9 }}];

```
