$ cnpm install splice-string
Remove or replace part of a string like
Array#splice
It correctly handles slicing strings with emoji.
$ npm install splice-string
import spliceString from 'splice-string';
spliceString('unicorn', 3, 4, 'verse');
//=> 'universe'
spliceString('❤️????????', 1, 1, '????');
//=> '❤️????????'
Type: string
Type: number
Index to start splicing.
Type: number
Number of characters to remove.
Type: string
String to insert in place of the removed substring.
Copyright 2013 - present © cnpmjs.org | Home |