Cody

# Problem 44661. Remove white spaces at the end of the input string

Solution 1742418

Submitted on 4 Mar 2019
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   Fail
A = 'This is a test string. '; y_correct = 'This is a test string.'; assert(isequal(rem_trail_ws(A),y_correct))

A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string. ' A = 'This is a test string.'

Operands to the || and && operators must be convertible to logical scalar values. Error in rem_trail_ws (line 2) while A(end) == ' ' || A(end) == '\t' Error in Test1 (line 3) assert(isequal(rem_trail_ws(A),y_correct))

2   Fail
A = ' Testing function rem_trail_ws'; y_correct = ' Testing function rem_trail_ws'; assert(isequal(rem_trail_ws(A),y_correct))

Operands to the || and && operators must be convertible to logical scalar values. Error in rem_trail_ws (line 2) while A(end) == ' ' || A(end) == '\t' Error in Test2 (line 3) assert(isequal(rem_trail_ws(A),y_correct))

3   Fail
A = {'MATLAB ','SIMULINK '; 'Toolboxes ','MathWorks '}; y_correct = {'MATLAB','SIMULINK'; 'Toolboxes','MathWorks'}; assert(isequal(rem_trail_ws(A),y_correct))

Undefined function 'eq' for input arguments of type 'cell'. Error in rem_trail_ws (line 2) while A(end) == ' ' || A(end) == '\t' Error in Test3 (line 5) assert(isequal(rem_trail_ws(A),y_correct))

4   Fail
A = sprintf('MATHWORKS \t'); y_correct = 'MATHWORKS'; assert(isequal(rem_trail_ws(A),y_correct))

Operands to the || and && operators must be convertible to logical scalar values. Error in rem_trail_ws (line 2) while A(end) == ' ' || A(end) == '\t' Error in Test4 (line 3) assert(isequal(rem_trail_ws(A),y_correct))