Skip to content

labelize

Transform a string to lowercase with capitalized first letters and spaces between words.

Splits on -, _, or existing spaces, capitalizes the first letter of each resulting word, lowercases the rest, and joins them with a single space.

Available since v1.0.1

import { labelize } from '@helpers4/string';
labelize(str: string): string
ParameterTypeDescription
strstringThe string to convert.

string — The labelized string.

labelize('hello-world_foo bar');
// => 'Hello World Foo Bar'

View on npm