Complete the code to check if the string 'hello' contains the substring 'll'.
result = [1]('hello', 'll');
The contains function returns true if the substring is found.
Complete the code to find the starting index of substring 'cat' in the string 'concatenate'.
index = [1]('concatenate', 'cat');
The strfind function returns the starting index of the substring.
Fix the error in the code to correctly find if 'dog' is in 'hotdog'.
found = [1]('hotdog', 'dog'); if found disp('Found!') end
contains returns a logical value suitable for if conditions.
Fill both blanks to create a dictionary of words and their starting indices if the word length is greater than 3.
words = {'apple', 'bat', 'cat', 'doge'};
indices = containers.Map();
for i = 1:length(words)
word = words{i};
if length(word) [1] 3
indices(word) = [2]('concatenate', word);
end
endUse > to check length and strfind to find the index.
Fill all three blanks to create a map of uppercase words and their indices if the word contains 'at'.
words = {'cat', 'dog', 'bat', 'rat'};
indices = containers.Map();
for i = 1:length(words)
word = words{i};
if [1](word, 'at')
indices([2]) = [3]('concatenate', word);
end
endUse contains to check substring, upper(word) as key, and strfind for index.