0% found this document useful (0 votes)
5 views2 pages

Python String Alphanumeric Methods

The document outlines various string methods in programming, detailing their functionality and runtime behavior. Key methods include Count, capitalize, Title, Index, Is Digit, Is alpha, Lower, Upper, Swap case, and Is alnum, each serving specific purposes like character conversion and validation. These methods are evaluated during program execution based on the input provided.

Uploaded by

spotispotify93
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Python String Alphanumeric Methods

The document outlines various string methods in programming, detailing their functionality and runtime behavior. Key methods include Count, capitalize, Title, Index, Is Digit, Is alpha, Lower, Upper, Swap case, and Is alnum, each serving specific purposes like character conversion and validation. These methods are evaluated during program execution based on the input provided.

Uploaded by

spotispotify93
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Methods :

1) Count ()
- returns how many times a particular element or substring
appears in a list, tuple, or string during program execution

2) capitalize ()

- method returns a copy of a string with the first character


capitalized and the rest lowercased, at runtime when the
code is executed.

3) Title ()

- method returns a new string where the first character of


each word is capitalized (like a book title), and it’s done at
runtime based on the input or string given.

4) Index ()

- method returns the position (index) of the first


occurrence of a specified element or substring in a list,
tuple, or string, and this happens during program
execution

5) Is Digit ()

- method checks if all characters in a string are digits (0–9).


It returns True if the string is numeric, else False, and this is
evaluated at runtime when the program runs.

6) Is alpha ()

- method checks if all characters in a string are alphabetic


letters (A–Z or a–z). It returns True if the string has only
letters, and False otherwise — and this is checked at runtime
when the program runs.
7) Lower ()

- method returns a copy of the string with all uppercase


letters converted to lowercase, and this transformation
happens at runtime — when the code is executed with actual
data.

8) Upper ()

- method returns a new string where all lowercase letters are converted to
uppercase, and this conversion happens at runtime — based on the actual
input or data during execution.

9) Swap case ()

- method returns a new string where uppercase letters


become lowercase and lowercase letters become
uppercase, and this change happens at runtime — based on
dynamic user input or variable data.

10) Is alnum ()

- method checks if a string contains only alphanumeric


characters that is, letters (A–Z, a–z) and digits (0–9) with
no spaces or special characters. It returns True if all
characters are alphanumeric, and False otherwise. This check
happens at runtime, based on real-time input or data

You might also like