finding a sting - function findstrthe function


Finding a sting - function findstr:

The function findstr receives two strings as input arguments. It finds all the occurrences of shorter string contained by the longer, and returns the subscripts of the starting of the occurrences. The order of strings does not matter with findstr; it always finds the shorter string within the longer, whichever it is. The shorter string can consist of one character, or any of the number of characters. If there is more than one occurrence of the shorter string within the longer one, the findstr returns a vector with all the indices. Note that, what is returned is the index of the starting of the shorter string.

 

>> findstr('abcde', 'd')

ans =

4

>> findstr('d','abcde')

ans =

4

>> findstr('abcde', 'bc')

ans =

2

>> findstr('abcdeabcdedd', 'd')

ans =

4  9  11  12

Request for Solution File

Ask an Expert for Answer!!
Applications of MATLAB: finding a sting - function findstrthe function
Reference No:- TGS0175084

Expected delivery within 24 Hours