# @ezs/strings

> Plugin d'instructions ezs pour traiter des chaînes de caractères

Latest version **1.0.6** (published 2026-04-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ezs/strings
pnpm add @ezs/strings
yarn add @ezs/strings
bun add @ezs/strings
```

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2026-04-08 |
| First published | 2023-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 18.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | François Parmentier |
| Maintainers | parmentf, touv, jj618 |
| Keywords | ezs, strings |

## Links

- npm: https://www.npmjs.com/package/@ezs/strings
- Repository: https://github.com/Inist-CNRS/ezs
- Homepage: https://github.com/Inist-CNRS/ezs/tree/master/packages/strings#readme
- Issues: https://github.com/Inist-CNRS/ezs/issues
- npm.io page: https://npm.io/package/@ezs/strings

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) 4.18.1
- [inflection](https://npm.io/package/inflection.md) 2.0.1

## 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

- 1.0.6 (latest) — 2026-04-08
- 1.0.5 — 2024-11-05
- 1.0.4 — 2024-02-07
- 1.0.3 — 2023-09-08
- 1.0.2 — 2023-07-17
- 1.0.1 — 2023-06-23
- 1.0.0 — 2023-06-23

## README

# `@ezs/strings`

Des intructions pour manipuler des chaînes de caratères.

## installation

```bash
npm install @ezs/core
npm install @ezs/strings
```

À mettre au début du script:

```ini
[use]
plugin = strings
```

## usage

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

*   [STRDecode](#strdecode)
*   [STREncode](#strencode)
*   [STRInflection](#strinflection)
*   [STRSentences](#strsentences)

### STRDecode

Decodes a given string using a provided mapping, replacing strings that
match values (to)in the mapping with their corresponding keys (from). Optionally, a
prefix and suffix can be set (they are removed too from strings).

This statement is the reverse of `encode`.

Input:

```json
[{
    "id": "1",
    "value": "Flow control based inffivesup MW wind turbine",
}, {
    "id": "2",
    "value": "Motion Characteristics of infonesupinfzerosup MW Superconducting Floating Offshore Wind Turbine",
}]
```

Script:

```ini
[STRDecode]
path = value
from = 1
to = one
from = 5
to = five
from = 0
to = zero
prefix = inf
suffix = sup
```

Output:

```json
[{
    "id": "1",
    "value": "Flow control based 5 MW wind turbine",
}, {
    "id": "2",
    "value": "Motion Characteristics of 10 MW Superconducting Floating Offshore Wind Turbine",
}]
```

> ⚠ You must give as much `from` as `to`.

See `encode`.

#### Parameters

*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The path of the string to be decoded, within data.
*   `from` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** An array of strings to replace with.
*   `to` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** An array of strings to be replaced.
*   `prefix` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A string to be removed from the beginning of each replaced substring. (optional, default `""`)
*   `suffix` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A string to be removed from the end of each replaced substring. (optional, default `""`)

### STREncode

Encodes a given string using a provided mapping, replacing characters that
match keys in the mapping with their corresponding values. Optionally, a
prefix and suffix can be added to the final result.

Input:

```json
[{
    "id": "1",
    "value": "Flow control based 5 MW wind turbine",
}, {
    "id": "2",
    "value": "Motion Characteristics of 10 MW Superconducting Floating Offshore Wind Turbine",
}]
```

Script:

```ini
[STREncode]
path = value
from = 1
to = one
from = 5
to = five
from = 0
to = zero
prefix = inf
suffix = sup
```

Output:

```json
[{
    "id": "1",
    "value": "Flow control based inffivesup MW wind turbine",
}, {
    "id": "2",
    "value": "Motion Characteristics of infonesupinfzerosup MW Superconducting Floating Offshore Wind Turbine",
}]
```

> ⚠ The replacements are made in the order of the `from` array. This means
> that if 1 is replaced with 2, and next 2 replaced with 3, a 1 is eventually
> replaced with 3.

> ⚠ You must give as much `from` as `to`.

See `STRDecode` to invert the processus.

#### Parameters

*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The path of the string to be encoded, within data.
*   `from` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** An array of strings to replace.
*   `to` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** An array of strings to replace with.
*   `prefix` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A string to be added to the beginning of each replaced substring. (optional, default `""`)
*   `suffix` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** A string to be added to the end of each replaced substring. (optional, default `""`)

### STRInflection

Take a `String` and inflect it with or more transformers from this list
pluralize, singularize, camelize, underscore, humanize, capitalize,
dasherize, titleize, demodulize, tableize, classify, foreign\_key, ordinalize

Input:

```json
{ "id": 1, "value": "all job" }
```

Script:

```ini
[STRInflection]
path = value
transform = pluralize
transform = capitalize
transform = dasherize
```

Output:

```json
{ "id": 1, "value": "All-jobs" }
```

> 📗 When the path is not given, the input data is considered as a string,
> allowing to apply `inflection` on a string stream.

see <https://www.npmjs.com/package/inflection>

#### Parameters

*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** path of the field to segment (optional, default `""`)
*   `transform` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** name of a transformer

Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;

### STRSentences

Take a `String` and split it into an array of sentences.

Input:

```json
{ "id": 1, "value": "First sentence? Second sentence. My name is Bond, J. Bond." }
```

Output:

```json
{ "id": 1, "value": ["First sentence?", "Second sentence.", "My name is Bond, J. Bond."] }
```

> 📗 When the path is not given, the input data is considered as a string,
> allowing to apply `inflection` on a string stream.

#### Parameters

*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** path of the field to segment (optional, default `""`)

Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;

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