Skip to content

String Operations (str_ops.py)

The String Operations module in NumLex provides various utilities for working with strings, including character checks, palindrome detection, and character counting.

Functions

  • is_vowel(char): Checks if a character is a vowel.

    check = is_vowel('a')
  • is_consonant(char): Checks if a character is a consonant.

    check = is_consonant('b')
  • find_char(string, char): Searches for a character in a string.

    found = find_char('hello', 'e')
  • is_palindrome(string): Checks if a string is a palindrome.

    palin = is_palindrome('radar')
  • cnt_char(string): Counts the occurrences of each character in a string.

    count = cnt_char('hello')