Cody

Problem 1218. Join Strings with Multiple Different Delimiters

Solution 2734360

Submitted on 23 Jul 2020 by Rachelle Lee
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
C = {'I','MATLAB'}; DELIMITER = {' love '} S= 'I love MATLAB' assert(isequal(your_fcn_name(C,DELIMITER),S))

DELIMITER = 1×1 cell array {' love '} S = 'I love MATLAB' S = 'I' S = 'I love MATLAB'

2   Pass
c = {'one', 'two', 'three'}; DELIM = {' + ', ' = '} S2= 'one + two = three' assert(isequal(your_fcn_name(c,DELIM),S2))

DELIM = 1×2 cell array {' + '} {' = '} S2 = 'one + two = three' S = 'one' S = 'one + two' S = 'one + two = three'

3   Pass
c = {'First sentence', 'Second sentence', 'Third sentence.'}; DELIM = {'. ', '. '} S2= 'First sentence. Second sentence. Third sentence.' assert(isequal(your_fcn_name(c,DELIM),S2))

DELIM = 1×2 cell array {'. '} {'. '} S2 = 'First sentence. Second sentence. Third sentence.' S = 'First sentence' S = 'First sentence. Second sentence' S = 'First sentence. Second sentence. Third sentence.'

4   Pass
c = {'Have you ', 'ever had ', 'someone continuously ', 'interrupting you?'}; DELIM = {'(HEY!) ', '(BOO!) ', '(LOOK OVER THERE!) '} S2= 'Have you (HEY!) ever had (BOO!) someone continuously (LOOK OVER THERE!) interrupting you?' assert(isequal(your_fcn_name(c,DELIM),S2))

DELIM = 1×3 cell array {'(HEY!) '} {'(BOO!) '} {'(LOOK OVER THERE!) '} S2 = 'Have you (HEY!) ever had (BOO!) someone continuously (LOOK OVER THERE!) interrupting you?' S = 'Have you ' S = 'Have you (HEY!) ever had ' S = 'Have you (HEY!) ever had (BOO!) someone continuously ' S = 'Have you (HEY!) ever had (BOO!) someone continuously (LOOK OVER THERE!) interrupting you?'

5   Pass
c = {'My first ', 'name ', 'is ', 'Tom.'}; DELIM = {'child has a ', 'that ', 'not '} S2= 'My first child has a name that is not Tom.' assert(isequal(your_fcn_name(c,DELIM),S2))

DELIM = 1×3 cell array {'child has a '} {'that '} {'not '} S2 = 'My first child has a name that is not Tom.' S = 'My first ' S = 'My first child has a name ' S = 'My first child has a name that is ' S = 'My first child has a name that is not Tom.'