Character Class Methods List

www.‮aeditfigi‬.com

Character class methods are methods that can be applied to a character or a string in programming languages such as Java, Python, or Ruby. Here are some commonly used character class methods:

  1. isalnum(): This method returns True if all the characters in the string are alphanumeric (letters or numbers), otherwise it returns False.

  2. isalpha(): This method returns True if all the characters in the string are alphabets, otherwise it returns False.

  3. isdigit(): This method returns True if all the characters in the string are digits, otherwise it returns False.

  4. islower(): This method returns True if all the characters in the string are in lower case, otherwise it returns False.

  5. isupper(): This method returns True if all the characters in the string are in upper case, otherwise it returns False.

  6. isspace(): This method returns True if all the characters in the string are whitespace (space, tab, or newline), otherwise it returns False.

  7. lower(): This method returns a copy of the string in all lower case.

  8. upper(): This method returns a copy of the string in all upper case.

  9. capitalize(): This method returns a copy of the string with the first character capitalized.

  10. swapcase(): This method returns a copy of the string with all the lower case characters converted to upper case and vice versa.

  11. title(): This method returns a copy of the string with the first character of each word capitalized.

  12. find(): This method returns the index of the first occurrence of the specified character or substring in the string.

  13. replace(): This method returns a copy of the string with all occurrences of a specified substring replaced with another substring.

  14. strip(): This method returns a copy of the string with all leading and trailing whitespace removed.

  15. split(): This method splits the string into a list of substrings based on a specified delimiter.