# splice-string

> Remove or replace part of a string like `Array#splice`

Latest version **3.0.0** (published 2021-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install splice-string
pnpm add splice-string
yarn add splice-string
bun add splice-string
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2021-04-15 |
| First published | 2015-08-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 1 |
| Unpacked size | 2.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 24 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | splice, string, split, modify, mutate, replace, insert, add, remove, delete |

## Links

- npm: https://www.npmjs.com/package/splice-string
- Repository: https://github.com/sindresorhus/splice-string
- Homepage: https://github.com/sindresorhus/splice-string#readme
- Issues: https://github.com/sindresorhus/splice-string/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/splice-string

## Dependencies (1)

- [lodash.toarray](https://npm.io/package/lodash.toarray.md) ^4.4.0

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 3.0.0 (latest) — 2021-04-15
- 2.0.0 — 2016-08-27
- 1.0.0 — 2015-08-19

## README

# 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

```js
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.

---
_Source: https://npm.io/package/splice-string · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
