def get_char_or_default()

in dataflux_core/range_splitter.py [0:0]


def get_char_or_default(characters: str, index: int, default_char: str) -> str:
    """Returns the character at the given index or the default character if the index is out of bounds.

    Args:
      characters (str): The range string to check.
      index (int): The current iteration index across characters.
      default_char (str): The smallest character in the implemented char set.

    Returns:
      The resulting character for the given index.
    """
    if index < 0 or index >= len(characters):
        return default_char

    return characters[index]