0001 function output=digitConvert4military(text)
0002
0003
0004 if nargin<1, selfdemo; return; end
0005
0006 original={'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
0007 target={'洞', '么', '兩', '三', '四', '五', '六', '拐', '八', '勾'};
0008
0009 output=text;
0010 for i=1:length(original)
0011 output=strrep(output, original{i}, target{i});
0012 end
0013
0014
0015 function selfdemo
0016 input='我家電話是: 5742796';
0017 output=digitConvert4military(input);
0018 fprintf('input = %s\n', input);
0019 fprintf('output = %s\n', output);