Skip to content

Latest commit

 

History

History
120 lines (62 loc) · 3.01 KB

velocitas_lib.text_utils.md

File metadata and controls

120 lines (62 loc) · 3.01 KB

module velocitas_lib.text_utils


function to_camel_case

to_camel_case(snake_str: str) → str

Return a camel case version of a snake case string.

Args:

  • snake_str (str): A snake case string.

Returns:

  • str: A camel case version of a snake case string.

function create_truncated_string

create_truncated_string(input: str, length: int) → str

Create a truncated version of input if it is longer than length. Will keep the rightmost characters and cut of the front if it is longer than allowed.

Args:

  • input (str): The input string.
  • length (int): The allowed overall length.

Returns:

  • str: A truncated string which has len() of length.

function replace_item_in_list

replace_item_in_list(
    text: List[str],
    matching_text: str,
    replacement: str = '',
    remove_empty: bool = False
) → List[str]

Replace the whole line which matches the given text with a replacement.

Args:

  • text (List[str]): All text lines to replace lines within.
  • text (str): The text to find the line with.
  • replacement (str): The replacement for line.
  • remove_empty (bool): If true and the replacement for a line is empty, the line will be removed.

function replace_text_area

replace_text_area(
    text: List[str],
    start_occurence: str,
    end_occurence: str,
    replacement: str = ''
) → List[str]

Replace all occurrences of all text areas matching the parameters with a replacement. If the replacement for a line is empty, then the line will be removed.

Args:

  • text (List[str]): All text lines to replace text within.
  • start_occurence (str): The starting line which matches the occurence for replacement text area.
  • start_occurence (str): The ending line which matches the occurence for replacement text area.
  • replacement (str): The replacement for text area.

This file was automatically generated via lazydocs.