# uni-string

> Unicode String object

Latest version **2.0.10** (published 2026-09-11) · ISC license · 0 weekly downloads

## Install

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

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.10 |
| Published | 2026-09-11 |
| First published | 2018-03-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 128.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | bluelovers |
| Maintainers | bluelovers |
| Keywords | ansi, astral, char, codepoints, codes, count, emoji, escape, length, runes, size, split, split string, string, surrogates, symbol, unicode, utf8, create-by-yarn-tool, create-by-tsdx |

## Links

- npm: https://www.npmjs.com/package/uni-string
- Repository: https://github.com/bluelovers/ws-string
- Homepage: https://github.com/bluelovers/ws-string/tree/master/packages/uni-string#readme
- Issues: https://github.com/bluelovers/ws-string/issues
- npm.io page: https://npm.io/package/uni-string

## Dependencies (2)

- [runes2](https://npm.io/package/runes2.md) ^1.1.10
- [es6-class-prototype](https://npm.io/package/es6-class-prototype.md) ^2.0.0

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 2.0.10 (latest) — 2026-09-11
- 2.0.9 — 2026-09-11
- 2.0.7 — 2024-01-29
- 2.0.6 — 2023-11-24
- 2.0.5 — 2023-04-12
- 2.0.4 — 2023-04-12
- 2.0.3 — 2022-11-01
- 2.0.2 — 2022-10-15
- 2.0.1 — 2022-09-16
- 1.1.17 — 2022-08-27
- 1.1.15 — 2022-08-26
- 1.1.12 — 2022-01-17
- 1.1.11 — 2021-07-05
- 1.1.10 — 2020-06-20
- 1.1.9 — 2020-06-10
- … 8 more at https://npm.io/package/uni-string/versions

## README

# uni-string

> Unicode-aware String object

## 安裝 (Installation)

```bash
# 使用 yarn / Using yarn
yarn add uni-string

# 使用 yarn-tool / Using yarn-tool
yarn-tool add uni-string
# yt 是 yarn-tool 的別名 / yt is an alias for yarn-tool
yt add uni-string

# 使用 pnpm / Using pnpm
pnpm add uni-string

# 使用 npm / Using npm
npm install uni-string
```

## api

* see [API](src/core.d.ts)
* [MDN String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)

## demo

```ts
import UString from 'packages/uni-string/src/index';

const UString = require('packages/uni-string/src/index')
```

```ts
console.log(UString.support);

let t = (new UString('♥️𠬠典')).padStart(10, '𠬠');

t = t.concat('\n♥️𠬠典そこで彼らは\'"，オリーブ山と呼ばれる山からエルサレムに帰った。');

console.dir(t);

let t2 = new UString(t);

console.log(t2);

//console.log(666, t2.substr(-9, 3));
console.log(666, t2.indexOf('𠬠典', 2));
console.log(666, t2.endsWith('𠬠典'));

let t3 = new UString('👩‍👩‍👧‍👦');
console.log(t3.size(), t3.split(''));
```

```ts
console.log('length', t2.length);
console.log('charLength', t2.charLength);
console.log('size()', t2.size());

//length 70
//charLength 49
//size() 49
```

## UString.support

```ts
{ 
  split: true,
  substr: true,
  substring: true,
  indexOf: true,
  includes: true,
  slice: true,
  charAt: true,
  startsWith: true,
  endsWith: true,
  padEnd: true,
  padStart: true }
```

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