myStrFindI - % use iteration to receive credit. You may use...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 %%PROBLEM 4%% % % Write a function named myStrFindI that takes in two strings. Your % function should return a vector containing the starting index of all % the occurences of the first string within the second string. Your % function should ignore differences in case. % % Note: you may *not* use the built-in strfind, findstr, or any other % string functions in MATLAB (except strcmp and/or strcmpi). You *must*
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % use iteration to receive credit. You may use strcmp and/or strcmpi for % this problem. function output = myStrFindI(str1, str2) index = 1 output = x = 1 while index <= length(str2) & (length(str2) - index) >= length(str1) if strcmpi(str1, str2(index:1:(index + length(str1) - 1))) == true output(x) = index x = x + 1 end index = index + 1 end end...
View Full Document

This note was uploaded on 07/06/2009 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online