function military = ch_to_military ( ch ) %*****************************************************************************80 % %% CH_TO_MILITARY converts an ASCII character to a Military code word. % % Example: % % 'A' 'Alpha' % 'B' 'Bravo' % 'Z' 'Zulu' % 'a' 'alpha' % '7' '7' % '%' '%' % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 22 February 2010 % % Author: % % John Burkardt % % Parameters: % % Input, character CH, the ASCII character. % % Output, string MILITARY, the military code word. % If CH is not an alphabetic letter, then MILITARY is simply set equal to CH. % code = [ ... 'alpha '; ... 'bravo '; ... 'charlie '; ... 'delta '; ... 'echo '; ... 'foxtrot '; ... 'golf '; ... 'hotel '; ... 'india '; ... 'juliet '; ... 'kilo '; ... 'lima '; ... 'mike '; ... 'november'; ... 'oscar '; ... 'papa '; ... 'quebec '; ... 'romeo '; ... 'sierra '; ... 'tango '; ... 'uniform '; ... 'victor '; ... 'whiskey '; ... 'x-ray '; ... 'yankee '; ... 'zulu ' ]; if ( 'A' <= ch && ch <= 'Z' ) military = code( ch - 'A' + 1, : ); military(1) = ch_cap ( military(1) ); elseif ( 'a' <= ch && ch <= 'z' ) military = code( ch - 'a' + 1, : ); else military = ch; end return end