Page 73 - tp_Modula_v2.0
P. 73

rstrip(): The rstrip() function removes any trailing whitespace (or specified characters) from

                     the string.
                     Syntax of using rstrip() function is:
                         string_name.rstrip()

                     isupper(): The isupper() function checks whether all the characters in the string are uppercase

                     letters.
                     Syntax of using isupper() function is:
                         string_name.isupper()

                     islower(): The islower() function checks whether all the characters in the string are lowercase

                     letters.
                     Syntax of using islower() function is:
                         string_name.islower()

                     isdigit(): The isdigit() function checks whether all the characters in the string are numeric
                     digits.

                     Syntax of using isdigit() function is:
                         string_name.isdigit()

                     isalpha(): The isalpha() function checks whether all the characters in the string are alphabetic
                     (letters only).
                     Syntax of using isalpha() function is:

                         string_name.isalpha()
                     isalnum():  The isalnum() function checks whether  all the characters  in the string are
                     alphanumeric (letters or digits).
                     Syntax of using isalnum() function is:

                         string_name.isalnum()

                    find(): The find() function returns the index of the first occurrence of a specified substring in
                     the string. If the substring is not found, it returns -1.
                     Syntax of using find() function is:
                         string_name.find(substring)

                    del statement: The del statement is used to delete an entire string (not part of a string).
                     Syntax of using del sattement function is:

                         del variable_name













                                                                                      String Handling in Python   71
   68   69   70   71   72   73   74   75   76   77   78