Cody

Problem 43645. Check if a string starts with another string

Solution 1043990

Submitted on 4 Nov 2016 by LY Cao
• Size: 14
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
s = 'Trick-or-treating is a customary celebration for children on Halloween'; q= 'trick' y_correct = true; assert(isequal(CheckString(s,q),y_correct))

q = trick

2   Pass
s = 'Trick-or-treating is a customary celebration for children on Halloween'; q= 'trick-Or' y_correct = true; assert(isequal(CheckString(s,q),y_correct))

q = trick-Or

3   Pass
s = 'Trick-or-treating is a customary celebration for children on Halloween'; q= 'trick--or' y_correct = false; assert(isequal(CheckString(s,q),y_correct))

q = trick--or

4   Pass
s = 'Haunted attractions are entertainment venues designed to thrill and scare patrons.'; q= 'Hello' y_correct = false; assert(isequal(CheckString(s,q),y_correct))

q = Hello