Languages
[Edit]
EN

TypeScript - replace part of string from given index

0 points
Created by:
Dollie-Rutledge
806

In this article, we're going to have a look at how to replace part of a string from a given index in TypeScript.

Quick solution:

 

1. Custom method example

Edit

Presented in this section solution allows inserting text outside of given string filling space with any characters (by default with space).

Output:

2. Custom method example with ES 2015

Edit

ES 2015 introduced repeat() method for string.

Output:

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join