MATLAB: Removing suffiex or prefix from sting

MATLAB

Hi there
i want code which delete the suffix or prefix in string please?

Best Answer

clc; clear all ;
str = 'unbecomingly';
prefix = 'un'; % The prefix to remove
suffix = 'ly'; % The suffix to remove
%
str = strrep(str,prefix,'') ;
str = strrep(str,suffix,'') ;