%% Select Text Before Position in Character Vector
% Create a character vector. Then create new character vectors that are substrings of chr.

chr = 'peppers and onions'

%
% Select the substring before the eighth position.

newChr = extractBefore(chr,8)

%
% Select text before a substring.

newChr = extractBefore(chr,' and')

% Copyright 2012 The MathWorks, Inc.