A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/sindresorhus/splice-string below:

sindresorhus/splice-string: Remove or replace part of a string like Array#splice

splice-string

Remove or replace part of a string like Array#splice

It correctly handles slicing strings with emoji.

Install
$ npm install splice-string
Usage
import spliceString from 'splice-string';

spliceString('unicorn', 3, 4, 'verse');
//=> 'universe'

spliceString('❤️🐴🐴', 1, 1, '🦄');
//=> '❤️🦄🐴'
API spliceString(string, index, count, insert?) string

Type: string

index

Type: number

Index to start splicing.

count

Type: number

Number of characters to remove.

insert

Type: string

String to insert in place of the removed substring.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4