Security News
Highlights from the 2024 Rails Community Survey
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
@stdlib/string
Advanced tools
Standard library string manipulation functions.
npm install @stdlib/string
var string = require( '@stdlib/string' );
Standard library string manipulation functions.
var str = string;
// returns {...}
The namespace exposes the following string manipulation functions:
camelcase( str )
: convert a string to camel case.capitalize( str )
: capitalize the first character in a string.codePointAt( string, position[, backward] )
: return a Unicode code point from a string at a specified position.constantcase( str )
: returns a string converted to a constant case.endsWith( str, search[, len] )
: test if a string ends with the characters of another string.fromCodePoint( pt1[, pt2[, pt3[, ...]]] )
: create a string from a sequence of Unicode code points.kebabcase( str )
: convert a string to kebab case.lpad( str, len[, pad] )
: left pad a string.ltrim( str )
: trim whitespace characters from the beginning of a string.lowercase( str )
: convert a string to lowercase.nextGraphemeClusterBreak( string[, fromIndex] )
: return the next extended grapheme cluster break in a string after a specified position.numGraphemeClusters( str )
: return the number of grapheme clusters in a string.pad( str, len[, options] )
: pad a string.percentEncode( str )
: percent-encode a UTF-16 encoded string according to RFC 3986.removeFirst( str )
: remove the first character of a string.removeLast( str )
: remove the last character of a string.removePunctuation( str )
: remove punctuation characters from a string.removeUTF8BOM( str )
: remove a UTF-8 byte order mark (BOM) from the beginning of a string.removeWords( str, words[, ignoreCase] )
: remove a list of words from a string.repeat( str, n )
: repeat a string a specified number of times and return the concatenated result.replace( str, search, newval )
: replace search occurrences with a replacement string.reverseString( str )
: reverse a string.rpad( str, len[, pad] )
: right pad a string.rtrim( str )
: trim whitespace characters from the end of a string.startcase( str )
: capitalize the first letter of each word in a string.startsWith( str, search[, position] )
: test if a string starts with the characters of another string.trim( str )
: trim whitespace characters from the beginning and end of a string.uncapitalize( str )
: uncapitalize the first character of a string.uppercase( str )
: convert a string to uppercase.utf16ToUTF8Array( str )
: convert a UTF-16 encoded string to an array of integers using UTF-8 encoding.var getKeys = require( '@stdlib/utils/keys' );
var string = require( '@stdlib/string' );
console.log( getKeys( string ) );
This package is part of 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, see the main project repository.
See LICENSE.
Copyright © 2016-2021. The Stdlib Authors.
0.0.13 (2021-08-22)
<section class="packages">FAQs
String manipulation functions.
The npm package @stdlib/string receives a total of 11,956 weekly downloads. As such, @stdlib/string popularity was classified as popular.
We found that @stdlib/string demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.