Logo

0x5a.live

for different kinds of informations and explorations.

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

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

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

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

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

Powered by 0x5a.live ๐Ÿ’—

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.

NodeJS Resources

are all listed below.

Resources

listed to get explored on!!

Made with โค๏ธ

to provide different kinds of informations and resources.