@stdlib/string

Standard library string manipulation functions.

https://github.com/stdlib-js/string

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.6%) to scientific vocabulary

Keywords

characters javascript lib library manipulation node node-js nodejs standard stdlib string text util utilities utility utils
Last synced: 4 months ago · JSON representation ·

Repository

Standard library string manipulation functions.

Basic Info
Statistics
  • Stars: 5
  • Watchers: 3
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Topics
characters javascript lib library manipulation node node-js nodejs standard stdlib string text util utilities utility utils
Created over 4 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security Notice

README.md

About stdlib...

We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.

The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.

When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.

To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!

String Manipulation

NPM version Build Status Coverage Status <!-- dependencies -->

String manipulation functions.

## Installation ```bash npm install @stdlib/string ``` Alternatively, - To load the package in a website via a `script` tag without installation and bundlers, use the [ES Module][es-module] available on the [`esm`][esm-url] branch (see [README][esm-readme]). - If you are using Deno, visit the [`deno`][deno-url] branch (see [README][deno-readme] for usage intructions). - For use in Observable, or in browser/node environments, use the [Universal Module Definition (UMD)][umd] build available on the [`umd`][umd-url] branch (see [README][umd-readme]). The [branches.md][branches-url] file summarizes the available branches and displays a diagram illustrating their relationships. To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.
## Usage ```javascript var string = require( '@stdlib/string' ); ``` #### string Namespace containing string manipulation functions. ```javascript var str = string; // returns {...} ``` The namespace exposes the following string manipulation functions:
- [`acronym( str[, options] )`][@stdlib/string/acronym]: generate an acronym for a given string. - [`base`][@stdlib/string/base]: base (i.e., lower-level) string functions. - [`camelcase( str )`][@stdlib/string/camelcase]: convert a string to camel case. - [`capitalize( str )`][@stdlib/string/capitalize]: capitalize the first character in a string. - [`codePointAt( string, position[, backward] )`][@stdlib/string/code-point-at]: return a Unicode code point from a string at a specified position. - [`constantcase( str )`][@stdlib/string/constantcase]: convert a string to constant case. - [`dotcase( str )`][@stdlib/string/dotcase]: convert a string to dot case. - [`endsWith( str, search[, len] )`][@stdlib/string/ends-with]: test if a string ends with the characters of another string. - [`first( str[, n][, options] )`][@stdlib/string/first]: return the first character(s) of a string. - [`forEach( str, [options,] clbk[, thisArg ] )`][@stdlib/string/for-each]: invokes a function for each character in a string. - [`format( str, ...args )`][@stdlib/string/format]: insert supplied variable values into a format string. - [`fromCodePoint( pt1[, pt2[, pt3[, ...]]] )`][@stdlib/string/from-code-point]: create a string from a sequence of Unicode code points. - [`headercase( str )`][@stdlib/string/headercase]: convert a string to HTTP header case. - [`kebabcase( str )`][@stdlib/string/kebabcase]: convert a string to kebab case. - [`last( str[, n][, options] )`][@stdlib/string/last]: return the last character(s) of a string. - [`lpad( str, len[, pad] )`][@stdlib/string/left-pad]: left pad a string. - [`ltrimN( str, n[, chars] )`][@stdlib/string/left-trim-n]: trim `n` characters from the beginning of a string. - [`ltrim( str )`][@stdlib/string/left-trim]: trim whitespace characters from the beginning of a string. - [`lowercase( str )`][@stdlib/string/lowercase]: convert a string to lowercase. - [`nextCodePointIndex( string[, fromIndex] )`][@stdlib/string/next-code-point-index]: return the position of the next Unicode code point in a string after a specified position. - [`nextGraphemeClusterBreak( string[, fromIndex] )`][@stdlib/string/next-grapheme-cluster-break]: return the next extended grapheme cluster break in a string after a specified position. - [`numGraphemeClusters( str )`][@stdlib/string/num-grapheme-clusters]: return the number of grapheme clusters in a string. - [`num2words( value[, options] )`][@stdlib/string/num2words]: convert a number to a word representation. - [`pad( str, len[, options] )`][@stdlib/string/pad]: pad a string. - [`pascalcase( str )`][@stdlib/string/pascalcase]: convert a string to Pascal case. - [`percentEncode( str )`][@stdlib/string/percent-encode]: percent-encode a UTF-16 encoded string according to RFC 3986. - [`prevGraphemeClusterBreak( string[, fromIndex] )`][@stdlib/string/prev-grapheme-cluster-break]: return the previous extended grapheme cluster break in a string before a specified position. - [`removeFirst( str[, n][, options] )`][@stdlib/string/remove-first]: remove the first character(s) of a string. - [`removeLast( str[, n][, options] )`][@stdlib/string/remove-last]: remove the last character(s) of a string. - [`removePunctuation( str )`][@stdlib/string/remove-punctuation]: remove punctuation characters from a string. - [`removeUTF8BOM( str )`][@stdlib/string/remove-utf8-bom]: remove a UTF-8 byte order mark (BOM) from the beginning of a string. - [`removeWords( str, words[, ignoreCase] )`][@stdlib/string/remove-words]: remove a list of words from a string. - [`repeat( str, n )`][@stdlib/string/repeat]: repeat a string a specified number of times and return the concatenated result. - [`replaceBefore( str, search, replacement )`][@stdlib/string/replace-before]: replace the substring before the first occurrence of a specified search string. - [`replace( str, search, newval )`][@stdlib/string/replace]: replace search occurrences with a replacement string. - [`reverse( str[, options] )`][@stdlib/string/reverse]: reverse a string. - [`rpad( str, len[, pad] )`][@stdlib/string/right-pad]: right pad a string. - [`rtrimN( str, n[, chars] )`][@stdlib/string/right-trim-n]: trim `n` characters from the end of a string. - [`rtrim( str )`][@stdlib/string/right-trim]: trim whitespace characters from the end of a string. - [`snakecase( str )`][@stdlib/string/snakecase]: convert a string to snake case. - [`splitGraphemeClusters( str )`][@stdlib/string/split-grapheme-clusters]: split a string by its grapheme cluster breaks. - [`startcase( str )`][@stdlib/string/startcase]: capitalize the first letter of each word in a string. - [`startsWith( str, search[, position] )`][@stdlib/string/starts-with]: test if a string starts with the characters of another string. - [`substringAfterLast( str, search[, fromIndex] )`][@stdlib/string/substring-after-last]: return the part of a string after the last occurrence of a specified substring. - [`substringAfter( str, search[, fromIndex] )`][@stdlib/string/substring-after]: return the part of a string after a specified substring. - [`substringBeforeLast( str, search )`][@stdlib/string/substring-before-last]: return the part of a string before the last occurrence of a specified substring. - [`substringBefore( str, search )`][@stdlib/string/substring-before]: return the part of a string before a specified substring. - [`graphemeClusters2iteratorRight( src[, mapFcn[, thisArg]] )`][@stdlib/string/to-grapheme-cluster-iterator-right]: create an iterator which iterates from right to left over grapheme clusters. - [`graphemeClusters2iterator( src[, mapFcn[, thisArg]] )`][@stdlib/string/to-grapheme-cluster-iterator]: create an iterator which iterates over grapheme clusters. - [`toWellFormed( str )`][@stdlib/string/to-well-formed]: create a new well-formed string. - [`trim( str )`][@stdlib/string/trim]: trim whitespace characters from the beginning and end of a string. - [`truncateMiddle( str, len[, seq] )`][@stdlib/string/truncate-middle]: truncate a string in the middle to a specified length. - [`truncate( str, len[, ending] )`][@stdlib/string/truncate]: truncate a string to a specified length. - [`uncapitalize( str )`][@stdlib/string/uncapitalize]: uncapitalize the first character of a string. - [`uppercase( str )`][@stdlib/string/uppercase]: convert a string to uppercase. - [`utf16ToUTF8Array( str )`][@stdlib/string/utf16-to-utf8-array]: convert a UTF-16 encoded string to an array of integers using UTF-8 encoding.
## Examples ```javascript var getKeys = require( '@stdlib/utils/keys' ); var string = require( '@stdlib/string' ); console.log( getKeys( string ) ); ```
* * * ## Notice This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. #### Community [![Chat][chat-image]][chat-url] --- ## License See [LICENSE][stdlib-license]. ## Copyright Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors].

Owner

  • Name: stdlib
  • Login: stdlib-js
  • Kind: organization

Standard library for JavaScript.

Citation (CITATION.cff)

cff-version: 1.2.0
title: stdlib
message: >-
  If you use this software, please cite it using the
  metadata from this file.

type: software

authors:
  - name: The Stdlib Authors
    url: https://github.com/stdlib-js/stdlib/graphs/contributors

repository-code: https://github.com/stdlib-js/stdlib
url: https://stdlib.io

abstract: |
  Standard library for JavaScript and Node.js.

keywords:
  - JavaScript
  - Node.js
  - TypeScript
  - standard library
  - scientific computing
  - numerical computing
  - statistical computing

license: Apache-2.0 AND BSL-1.0

date-released: 2016

GitHub Events

Total
  • Push event: 183
  • Create event: 8
Last Year
  • Push event: 183
  • Create event: 8

Committers

Last synced: almost 2 years ago

All Time
  • Total Commits: 254
  • Total Committers: 1
  • Avg Commits per committer: 254.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 106
  • Committers: 1
  • Avg Commits per committer: 106.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
stdlib-bot n****y@s****o 254
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • npm 84,428 last-month
  • Total docker downloads: 481,210,190
  • Total dependent packages: 39
  • Total dependent repositories: 284
  • Total versions: 24
  • Total maintainers: 4
npmjs.org: @stdlib/string

String manipulation functions.

  • Homepage: https://stdlib.io
  • License: Apache-2.0
  • Latest release: 0.3.3
    published about 1 year ago
  • Versions: 24
  • Dependent Packages: 39
  • Dependent Repositories: 284
  • Downloads: 84,428 Last month
  • Docker Downloads: 481,210,190
Rankings
Docker downloads count: 0.1%
Downloads: 0.6%
Dependent packages count: 0.7%
Dependent repos count: 0.9%
Average: 4.4%
Forks count: 11.6%
Stargazers count: 12.2%
Funding
  • type: opencollective
  • url: https://opencollective.com/stdlib
Last synced: 4 months ago

Dependencies

package.json npm
  • @stdlib/array github:stdlib-js/array development
  • @stdlib/bench github:stdlib-js/bench development
  • @stdlib/buffer github:stdlib-js/buffer development
  • @stdlib/datasets github:stdlib-js/datasets development
  • @stdlib/random github:stdlib-js/random development
  • istanbul ^0.4.1 development
  • proxyquire ^2.0.0 development
  • tap-spec 5.x.x development
  • tape git+https://github.com/kgryte/tape.git#fix/globby development
  • @stdlib/assert github:stdlib-js/assert#main
  • @stdlib/cli github:stdlib-js/cli#main
  • @stdlib/constants github:stdlib-js/constants#main
  • @stdlib/fs github:stdlib-js/fs#main
  • @stdlib/math github:stdlib-js/math#main
  • @stdlib/nlp github:stdlib-js/nlp#main
  • @stdlib/process github:stdlib-js/process#main
  • @stdlib/regexp github:stdlib-js/regexp#main
  • @stdlib/streams github:stdlib-js/streams#main
  • @stdlib/types github:stdlib-js/types#main
  • @stdlib/utils github:stdlib-js/utils#main
.github/workflows/benchmark.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
.github/workflows/cancel.yml actions
  • styfle/cancel-workflow-action 0.11.0 composite
.github/workflows/close_pull_requests.yml actions
  • superbrothers/close-pull-request v3 composite
.github/workflows/examples.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
.github/workflows/npm_downloads.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • actions/upload-artifact v3 composite
  • distributhor/workflow-webhook v3 composite
.github/workflows/productionize.yml actions
  • act10ns/slack v1 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • stdlib-js/bundle-action main composite
  • stdlib-js/transform-errors-action main composite
.github/workflows/publish.yml actions
  • JS-DevTools/npm-publish v1 composite
  • act10ns/slack v1 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • styfle/cancel-workflow-action 0.11.0 composite
.github/workflows/test.yml actions
  • act10ns/slack v1 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
.github/workflows/test_bundles.yml actions
  • act10ns/slack v1 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • denoland/setup-deno v1 composite
.github/workflows/test_coverage.yml actions
  • act10ns/slack v1 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • codecov/codecov-action v3 composite
  • distributhor/workflow-webhook v3 composite
.github/workflows/test_install.yml actions
  • act10ns/slack v1 composite
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
acronym/package.json npm
base/camelcase/package.json npm
base/capitalize/package.json npm
base/code-point-at/package.json npm
base/constantcase/package.json npm
base/distances/levenshtein/package.json npm
base/distances/package.json npm
base/dotcase/package.json npm
base/ends-with/package.json npm
base/first/package.json npm
base/first-code-point/package.json npm
base/first-grapheme-cluster/package.json npm
base/for-each/package.json npm
base/for-each-code-point/package.json npm
base/for-each-grapheme-cluster/package.json npm
base/format-interpolate/package.json npm
base/format-tokenize/package.json npm
base/headercase/package.json npm
base/invcase/package.json npm
base/kebabcase/package.json npm
base/left-pad/package.json npm
base/left-trim/package.json npm
base/lowercase/package.json npm
base/package.json npm
base/pascalcase/package.json npm
base/percent-encode/package.json npm
base/remove-first/package.json npm
base/remove-first-code-point/package.json npm
base/remove-first-grapheme-cluster/package.json npm
base/remove-last/package.json npm
base/remove-last-code-point/package.json npm
base/remove-last-grapheme-cluster/package.json npm
base/repeat/package.json npm
base/replace/package.json npm
base/replace-before/package.json npm
base/right-pad/package.json npm
base/right-trim/package.json npm
base/snakecase/package.json npm
base/startcase/package.json npm
base/starts-with/package.json npm
base/trim/package.json npm
base/uncapitalize/package.json npm
base/uppercase/package.json npm
camelcase/package.json npm
capitalize/package.json npm
code-point-at/package.json npm
constantcase/package.json npm
dotcase/package.json npm
ends-with/package.json npm
first/package.json npm
for-each/package.json npm
format/package.json npm
from-code-point/package.json npm
headercase/package.json npm
kebabcase/package.json npm
left-pad/package.json npm
left-trim/package.json npm
left-trim-n/package.json npm
lowercase/package.json npm
next-grapheme-cluster-break/package.json npm
num-grapheme-clusters/package.json npm
num2words/package.json npm
pad/package.json npm
pascalcase/package.json npm
percent-encode/package.json npm
prev-grapheme-cluster-break/package.json npm
remove-first/package.json npm
remove-last/package.json npm
remove-punctuation/package.json npm
remove-utf8-bom/package.json npm
remove-words/package.json npm
repeat/package.json npm
replace/package.json npm
replace-before/package.json npm
reverse/package.json npm
right-pad/package.json npm
right-trim/package.json npm
right-trim-n/package.json npm
snakecase/package.json npm
split-grapheme-clusters/package.json npm
startcase/package.json npm
starts-with/package.json npm
substring-after/package.json npm
substring-after-last/package.json npm
substring-before/package.json npm
substring-before-last/package.json npm
to-grapheme-cluster-iterator/package.json npm
to-grapheme-cluster-iterator-right/package.json npm