“Let’s learn Different Built-in Functions for String Data Type”-Part II
Hello everyone Sandesh here again,in previous article we have seen few built in functions for string data type.
Today we will go ahead to learn some more built in functions.Here are the some built in functions are below that we are going learn.
1]isalnum
2]isalpha
3]isdecimal
4]isdigit
5]islower
6]isnumeric
7]isprintable
8]isspace
9]istitle
10]isupper
1] isalnum
Here is the Built in function ‘isalnum’.
The isalnum method returns True if all the characters are alphanumeric, alphabet(a-z) and numbers (0-9).But space, ! # % & ? . are special characters are not allowed as alphanumeric. If we add any special characters in a string it will show False.
syntax
>>>variable.isalnum()
2] isalpha
The isalpha method returns True if all the characters are alphabet (a-z).
And returns False in any special characters are there.
space,!, #, % ,&, ?, .
syntax
>>>variable.isalpha()
3]isdecimal
The method returns True if all the characters are decimals (0-9).
Again it will print False if any special characters or any number appears.
syntax
>>>variable.isdecimal()
4]isdigit
Return True if the string is a digit string, False otherwise. A string is a digit string if all characters in the string are digits and there is at least one character in the string.
syntax
>>>variable.isdigit()
5] islower
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and
there is at least one cased character in the string.
syntax
>>>variable.islower()
6] isnumeric
Return True if the string is a numeric string, False otherwise.A string is numeric if all characters in the string are numeric and there is at
least one character in the string.
syntax
>>>variable.isnumeric()
7] isprintable
Return True if the string is printable, False otherwise.
A string is printable if all of its characters are considered printable in
repr() or if it is empty.
syntax
>>>variable.isprintable()
7] isspace
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
syntax
>>>variable.isspace()
8] istitle
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only
follow uncased characters and lowercase characters only cased ones.
syntax
>>>variable.istitle()
9] isupper
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and
there is at least one cased character in the string.
syntax
>>>variable.upper()