Space in specific location of a string

Hi,

let us say i have string “12327567889” where 27 should be replaced by one space.
how to do that?

One way to do it.

// split on the 27 and join back together with a space.
"12327567889".split('27').join(' ')
1 Like

Another way

let newStr = "12327567889".replace("27", " ");
2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.