Searching of String in Python.|methods|sub-strings.
Searching of String.
This is the process of checking occurance of substring in whole string or in a substring finding the characyers if starting index BEG and End ending index are given.
Here, return value of this function will be an index if found or -1 otherwise.
Example:
output:
Various methods of string class is used to search the substring in a given string.
bool endswith(str1,str2)
output:
bool startswith(str1,str2)
output:
int find(str1,str2)
output:
int rfind(str1,str2)
output:
int count(str1 str)
output:
Comments
Post a Comment