Topic- String functions – isspace(),istitle(),lstrip(),rstrip(), capitalize()
string functions isspace() – used to check the string is space x= “ " print x.isspace() ->True istitle() – check whether the string is in title case x= “I Like Computer“ print x.istitle() ->True
string functions lstrip() – removes extra space from left. x= “ book " print x.lstrip() OUTPUT book rstrip() – removes extra space from right. x= “ book " print x.rstrip()
string functions lstrip(CHAR) – removes particular character from left. x= “ xxbookxx" print x.lstrip(‘x’) OUTPUT bookxx rstrip(CHAR) – removes particular character from right. x= “ xxbookxx“ print x.rstrip(‘x’) xxbook
string functions lstrip(string ) x= “ there" print x.lstrip(‘ht’) rstrip(string ) print x.rstrip(‘er’)
string functions capitalize() – converts the first letter to upper case. x= “computer science " print x.capitalize() OUTPUT Computer science