www.gusucode.com > risk 工具箱matlab源码程序 > risk/+risk/+internal/+app/+utils/formatNamesWithoutSpace.m

    function OutNames = formatNamesWithoutSpace(InNames,StrPattern)
% FORMATNAMESWITHOUTSPACE Formats names of algorithm to add a space after 
%   input 'StrPattern'. For example, "EqualWidth" is formatted into "Equal
%   Width" using the following syntax:
%
%       formatNamesWithoutSpace({'EqualWidth'},'equal'
%
%   InNames is a cell array of strings. StrPatter is a string object.
%   It is used by BINNINGAPP and BINNINGAPPALGORITHMSETTINGS, in the 
%   BINNINGEXPLORERAPP class.
%
%   This is an internal function that is not meant to be called directly
%   by the user.

% Copyright 2016 The MathWorks, Inc. 

    
    OutNames = InNames;
    for i = 1 : length(InNames)
        [iStart,iEnd] = regexpi(InNames{i},StrPattern);
        if ~isempty(iStart)
            OutNames{i} = [InNames{i}(iStart:iEnd) ' ' InNames{i}(iEnd+1:end)];
        end
    end
    
end