We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Useful methods to deal with strings.
Transforms a string into a slug string, eligible for web URLs.
Normalizes the string by replacing spaces with dashes and special characters with simpler ASCII equivalents.
It is possible to transform the string into full lowercase or full uppercase by setting the lower or upper options.
lower
upper
import { slugify } from '@jsweb/utils/modules/string' const test = 'Hello World' slugify(test) // Hello-World slugify(test, { lower: true }) // hello-world slugify(test, { upper: true }) // HELLO-WORLD
Renders a tagged template string with the given data and returns the result string.
Useful to render templates with dynamic data.
import { template } from '@jsweb/utils/modules/string' template('Hello ${name}!', { name: 'World' }) // Hello World! template('Lorem ${ipsum} dolor ${sit} amet', { ipsum: 'foo', sit: 'bar', }) // Lorem foo dolor bar amet