string-length

WebJar for string-length

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

string-length
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

string-length
WebJar for string-length
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/string-length

Download string-length

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/string-length/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>string-length</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/string-length/
implementation 'org.webjars.npm:string-length:2.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/string-length/
implementation ("org.webjars.npm:string-length:2.0.0")
'org.webjars.npm:string-length:jar:2.0.0'
<dependency org="org.webjars.npm" name="string-length" rev="2.0.0">
  <artifact name="string-length" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='string-length', version='2.0.0')
)
libraryDependencies += "org.webjars.npm" % "string-length" % "2.0.0"
[org.webjars.npm/string-length "2.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : astral-regex jar [1.0.0,2)
org.webjars.npm : strip-ansi jar [4.0.0,5)

Project Modules

There are no modules declared in this project.

string-length Build Status

Get the real length of a string - by correctly counting astral symbols and ignoring ansi escape codes

String#length erroneously counts astral symbols as two characters.

Install

$ npm install string-length

Usage

const stringLength = require('string-length');

'🐴'.length;
//=> 2

stringLength('🐴');
//=> 1

stringLength('\u001B[1municorn\u001B[22m');
//=> 7

Related


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Versions

Version
2.0.0
1.0.1
1.0.0
0.1.2