syntactic.capitalize

syntactic.capitalize(obj: str | list[str], strict: bool = False) list[str]

Capitalize the first letter of each space-delimited word.

Parameters:
  • obj (str or list of str) – String(s) to capitalize.

  • strict (bool) – Lowercase the remaining characters of each word. When False (default), only the first letter of each word is touched.

Returns:

Capitalized string(s).

Return type:

list of str

Examples

>>> capitalize(["fooBar", "HELLO"])
['FooBar', 'HELLO']
>>> capitalize(["fooBar", "HELLO"], strict=True)
['Foobar', 'Hello']