Function reference

Assertions

stringutils.contains(string, matches)[source]

Determine if a string contains any of the given values. matches may be a single string, or a list of strings.

stringutils.contains_all(string, matches)[source]

Determine if a string contains all of the given values.

stringutils.is_whitespace(string)[source]

Determine if a string contains only whitespace characters or is empty.

Case conversion

All functions which convert to programming case formats accept strings in any of the other formats.

stringutils.camel_case(string)[source]

Convert a string identifier to camelCase.

stringutils.dashed_case(string)[source]

Convert a string identifier to dashed-case. If the string is in snake_case, capitalization of words will be preserved.

stringutils.lcfirst(string)[source]

Convert the first character of a string to lowercase.

stringutils.pascal_case(string)[source]

Convert a string identifier to PascalCase.

stringutils.snake_case(string)[source]

Convert a string identifier to snake_case. If the string is in dashed-case, capitalization of words will be preserved.

stringutils.title_case(string)[source]

Convert a string identifier to Title Case.

stringutils.ucfirst(string)[source]

Convert the first character of a string to uppercase.

Lists

stringutils.concat(strings)[source]

Concatenate a list of strings into a single string.

stringutils.join(strings, sep=', ', insertend=False)[source]

Concatenate a list of strings into a single string by a separating delimiter. If insertend is given and true, the delimiter is also included at the end of the string.

stringutils.lines(string, keepends=False)[source]

Split a string into a list of strings at newline characters. Unless keepends is given and true, the resulting strings do not have newlines included.

stringutils.split_identifier(string)[source]

Split a string identifier into a list of its subparts.

stringutils.words(string)[source]

Split a string into a list of words, which were delimited by one or more whitespace characters.

stringutils.unlines(lines, newline='\n')[source]

Join a list of lines into a single string after appending a terminating newline character to each.

stringutils.unwords(words)[source]

Join a list of words into a single string with separating spaces.

Transformations

stringutils.reverse(string)[source]

Reverse the order of the characters in a string.