Skip to content

String Helpers

Utility functions for working with string operations.

FunctionDescription
camelCaseConverts kebab-case to camelCase
capitalizeCapitalizes the first letter of a string
extractErrorMessageConvert an error to a readable message.
injectWordBreaksAdds word-break opportunities to a string so it can wrap cleanly in narrow UI containers such as side panels or table…
kebabCaseConverts camelCase to kebab-case
padStart / padEndnative JS String.prototype.padStart() / padEnd() (ES2017)
pascalCaseConverts a string to PascalCase.
repeatnative JS String.prototype.repeat() (ES2015)
slugifyConverts a string into a URL-friendly slug.
snakeCaseConverts a string to snake_case.
startsWith / endsWithnative JS String.prototype.startsWith() / endsWith() (ES2015)
titleCaseConverts a string to Title Case.
trim / trimStart / trimEndnative JS String.prototype.trim() / trimStart() / trimEnd() (ES2019)
truncateTruncates a string to maxLength characters, appending an ellipsis when cut.