Skip to content

Files

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Dec 18, 2024
Sep 14, 2024
Sep 19, 2024
May 18, 2024
Dec 8, 2024
Nov 3, 2023
Dec 18, 2024
Jan 10, 2024
Nov 20, 2024
Dec 10, 2024
Dec 24, 2024
Feb 13, 2023
Dec 17, 2024
Dec 17, 2024
May 14, 2024
Sep 21, 2024
Sep 21, 2024
Sep 21, 2024
Sep 21, 2024
Sep 21, 2024
Dec 8, 2024
Apr 19, 2025
May 18, 2024
Dec 21, 2024
Jan 11, 2025
May 18, 2024
Feb 21, 2025
Dec 8, 2024
May 18, 2024
Dec 15, 2024
Sep 19, 2024
Dec 31, 2024
Dec 8, 2024
Aug 19, 2023
Dec 27, 2024
Dec 15, 2024
Dec 21, 2024
Dec 8, 2024
Dec 8, 2024
Dec 8, 2024
Aug 19, 2023
Dec 8, 2024
Dec 14, 2024
May 14, 2024
Dec 11, 2024
Dec 27, 2024
May 18, 2024
Dec 25, 2024
May 14, 2024
Jan 6, 2025
Dec 19, 2024
Apr 9, 2025
Mar 15, 2025
Mar 15, 2025
Dec 14, 2024
Dec 19, 2024
Dec 24, 2024
Dec 29, 2024
Jul 24, 2023
Dec 18, 2024
Nov 10, 2023
Feb 25, 2025
Feb 9, 2025
Nov 21, 2024
Oct 27, 2022

Base String

Base (i.e., lower-level) string functions.

Usage

var string = require( '@stdlib/string/base' );

string

Namespace containing "base" (i.e., lower-level) string functions.

var ns = string;
// returns {...}

The namespace contains the following functions:

Examples

var ns = require( '@stdlib/string/base' );

// Generate a Pascal case string...
var str = ns.pascalcase( 'beep boop' );
// returns 'BeepBoop'

// Tokenize a string into an array of string parts and format identifier objects...
str = 'The %d %s foxes jumped over the %d %s dogs.';
var tokens = ns.formatTokenize( str );
// returns [ 'The ', {...}, ' ', {...}, ' foxes jumped over the ', {...}, ' ', {...}, ' dogs.' ]

// Generate a string from a token array by interpolating values...
str = ns.formatInterpolate( tokens, 3, 'quick', 4, 'lazy' );
// returns 'The 3 quick foxes jumped over the 4 lazy dogs.'

// Test whether a string starts with the characters of another string...
str = 'Lorem ipsum dolor sit amet';
var bool = ns.startsWith( str, 'Lorem' );
// returns true

// Test whether a string ends with the characters of another string...
bool = ns.endsWith( str, 'amet' );
// returns true

// Trim whitespace characters from the beginning and end of a string...
str = '   \t\n Lorem ipsum dolor sit amet   \n\t  ';
str = ns.trim( str );
// returns 'Lorem ipsum dolor sit amet'