String Helpers
Utility functions for working with string operations.
Functions
Section titled “Functions”| Function | Description |
|---|---|
camelCase | Converts kebab-case to camelCase |
capitalize | Capitalizes the first letter of a string |
extractErrorMessage | Convert an error to a readable message. |
injectWordBreaks | Adds word-break opportunities to a string so it can wrap cleanly in narrow UI containers such as side panels or table… |
kebabCase | Converts camelCase to kebab-case |
padStart / padEnd | native JS String.prototype.padStart() / padEnd() (ES2017) |
pascalCase | Converts a string to PascalCase. |
repeat | native JS String.prototype.repeat() (ES2015) |
slugify | Converts a string into a URL-friendly slug. |
snakeCase | Converts a string to snake_case. |
startsWith / endsWith | native JS String.prototype.startsWith() / endsWith() (ES2015) |
titleCase | Converts a string to Title Case. |
trim / trimStart / trimEnd | native JS String.prototype.trim() / trimStart() / trimEnd() (ES2019) |
truncate | Truncates a string to maxLength characters, appending an ellipsis when cut. |