Returns a function that splits a string on a character or substring
Returns a function that splits a string on a character or substring
Reduce fn that joins neighboring strings
Reduce fn that joins neighboring strings
Given an array of strings, returns a new array where all neighboring strings have been joined.
let arr = ["foo", "bar", 1, "baz", "", "qux" ];
arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ]
Returns a string shortened to a maximum length
Returns a string shortened to a maximum length
If the string is already less than the max
length, return the string.
Else return the string, shortened to max - 3
and append three dots ("...").
the maximum length of the string to return
the input string
Returns a string, with spaces added to the end, up to a desired str length
Returns a string, with spaces added to the end, up to a desired str length
If the string is already longer than the desired length, return the string.
Else returns the string, with extra spaces on the end, such that it reaches length
characters.
the desired length of the string to return
the input string
Splits on a delimiter, but returns the delimiters in the array
Splits on a delimiter, but returns the delimiters in the array
var splitOnSlashes = splitOnDelim('/');
splitOnSlashes("/foo"); // ["/", "foo"]
splitOnSlashes("/foo/"); // ["/", "foo", "/"]
Generated using TypeDoc
Functions that manipulate strings
Although these functions are exported, they are subject to change without notice.
common_strings