\hypertarget{namespacemom__string__functions}{}\doxysection{mom\+\_\+string\+\_\+functions Module Reference}
\label{namespacemom__string__functions}\index{mom\_string\_functions@{mom\_string\_functions}}


\doxysubsection{Detailed Description}
Handy functions for manipulating strings. 

By Alistair Adcroft and Robert Hallberg, last updated Sept. 2013.

The functions here perform a set of useful manipulations of character strings. Although they are a part of M\+O\+M6, the do not require any other M\+OM software to be useful. \doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
character(len=len(input\+\_\+string)) function, public \mbox{\hyperlink{namespacemom__string__functions_a4d76e9e8c2cd53f210b02006924a9212}{lowercase}} (input\+\_\+string)
\begin{DoxyCompactList}\small\item\em Return a string in which all uppercase letters have been replaced by their lowercase counterparts. \end{DoxyCompactList}\item 
character(len=len(input\+\_\+string)) function, public \mbox{\hyperlink{namespacemom__string__functions_aca148baf726de2f028b7e7baad3c85d4}{uppercase}} (input\+\_\+string)
\begin{DoxyCompactList}\small\item\em Return a string in which all uppercase letters have been replaced by their lowercase counterparts. \end{DoxyCompactList}\item 
character(len=19) function, public \mbox{\hyperlink{namespacemom__string__functions_ae6b4260129cce257d834cc9b32e847f3}{left\+\_\+int}} (i)
\begin{DoxyCompactList}\small\item\em Returns a character string of a left-\/formatted integer e.\+g. \char`\"{}123       \char`\"{} (assumes 19 digit maximum) \end{DoxyCompactList}\item 
character(len=1320) function, public \mbox{\hyperlink{namespacemom__string__functions_a0db6538cb622d0f20a577b07cb545f2e}{left\+\_\+ints}} (i)
\begin{DoxyCompactList}\small\item\em Returns a character string of a comma-\/separated, compact formatted, integers e.\+g. \char`\"{}1, 2, 3, 4\char`\"{}. \end{DoxyCompactList}\item 
character(len=32) function, public \mbox{\hyperlink{namespacemom__string__functions_ab56b89fb51a387279afc68c85d30dca2}{left\+\_\+real}} (val)
\begin{DoxyCompactList}\small\item\em Returns a left-\/justified string with a real formatted like \textquotesingle{}(G)\textquotesingle{}. \end{DoxyCompactList}\item 
character(len=1320) function, public \mbox{\hyperlink{namespacemom__string__functions_a07fa1b92ce5c4c4336bb45c5a89fa548}{left\+\_\+reals}} (r, sep)
\begin{DoxyCompactList}\small\item\em Returns a character string of a comma-\/separated, compact formatted, reals e.\+g. \char`\"{}1., 2., 5$\ast$3., 5.\+E2\char`\"{}. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__string__functions_aec369a6ac0badc1dbd782a1668d2c7c3}{isformattedfloatequalto}} (str, val)
\begin{DoxyCompactList}\small\item\em Returns True if the string can be read/parsed to give the exact value of \char`\"{}val\char`\"{}. \end{DoxyCompactList}\item 
character(len=120) function, public \mbox{\hyperlink{namespacemom__string__functions_a7bfdab6bba33230cc94ed625e95022c9}{extractword}} (string, n)
\begin{DoxyCompactList}\small\item\em Returns the string corresponding to the nth word in the argument or \char`\"{}\char`\"{} if the string is not long enough. Both spaces and commas are interpreted as separators. \end{DoxyCompactList}\item 
character(len=120) function, public \mbox{\hyperlink{namespacemom__string__functions_aad76dee92b69dab4488da049fe11cdb8}{extract\+\_\+word}} (string, separators, n)
\begin{DoxyCompactList}\small\item\em Returns the string corresponding to the nth word in the argument or \char`\"{}\char`\"{} if the string is not long enough. Words are delineated by the mandatory separators argument. \end{DoxyCompactList}\item 
integer function, public \mbox{\hyperlink{namespacemom__string__functions_aae12046c1401f23bd7e038655e30654e}{extract\+\_\+integer}} (string, separators, n, missing\+\_\+value)
\begin{DoxyCompactList}\small\item\em Returns the integer corresponding to the nth word in the argument. \end{DoxyCompactList}\item 
real function, public \mbox{\hyperlink{namespacemom__string__functions_a2f700337c5cf4e70a48bd0663570484e}{extract\+\_\+real}} (string, separators, n, missing\+\_\+value)
\begin{DoxyCompactList}\small\item\em Returns the real corresponding to the nth word in the argument. \end{DoxyCompactList}\item 
character(len=120) function, public \mbox{\hyperlink{namespacemom__string__functions_a60262e56f544e4613754df43bf50652e}{remove\+\_\+spaces}} (string)
\begin{DoxyCompactList}\small\item\em Returns string with all spaces removed. \end{DoxyCompactList}\item 
logical function, public \mbox{\hyperlink{namespacemom__string__functions_a7b7aa802a4da2021801267f6c6f890bf}{string\+\_\+functions\+\_\+unit\+\_\+tests}} (verbose)
\begin{DoxyCompactList}\small\item\em Returns true if a unit test of string\+\_\+functions fails. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__string__functions_a3f4583fac417ae45e370035ce0eecb04}{localtests}} (verbose, str1, str2)
\begin{DoxyCompactList}\small\item\em True if str1 does not match str2. False otherwise. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__string__functions_a1ca01e01cf691da9ea4dd5c20ad81770}{localtesti}} (verbose, i1, i2)
\begin{DoxyCompactList}\small\item\em True if i1 is not equal to i2. False otherwise. \end{DoxyCompactList}\item 
logical function \mbox{\hyperlink{namespacemom__string__functions_a7ed3314f4fae014b9c35c321320063b2}{localtestr}} (verbose, r1, r2)
\begin{DoxyCompactList}\small\item\em True if r1 is not equal to r2. False otherwise. \end{DoxyCompactList}\item 
character(len=len(dir)+2) function, public \mbox{\hyperlink{namespacemom__string__functions_af18b819f6c6a917c57b9690d0580f642}{slasher}} (dir)
\begin{DoxyCompactList}\small\item\em Returns a directory name that is terminated with a \char`\"{}/\char`\"{} or \char`\"{}./\char`\"{} if the argument is an empty string. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__string__functions_aae12046c1401f23bd7e038655e30654e}\label{namespacemom__string__functions_aae12046c1401f23bd7e038655e30654e}} 
\index{mom\_string\_functions@{mom\_string\_functions}!extract\_integer@{extract\_integer}}
\index{extract\_integer@{extract\_integer}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{extract\_integer()}{extract\_integer()}}
{\footnotesize\ttfamily integer function, public mom\+\_\+string\+\_\+functions\+::extract\+\_\+integer (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{string,  }\item[{character(len=$\ast$), intent(in)}]{separators,  }\item[{integer, intent(in)}]{n,  }\item[{integer, intent(in), optional}]{missing\+\_\+value }\end{DoxyParamCaption})}



Returns the integer corresponding to the nth word in the argument. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em string} & String to scan \\
\hline
\mbox{\texttt{ in}}  & {\em separators} & Characters to use for delineation \\
\hline
\mbox{\texttt{ in}}  & {\em n} & Number of word to extract \\
\hline
\mbox{\texttt{ in}}  & {\em missing\+\_\+value} & Value to assign if word is missing \\
\hline
\end{DoxyParams}


Definition at line 245 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{246   \textcolor{keywordtype}{character(len=*)},   \textcolor{keywordtype}{intent(in)} :: string\textcolor{comment}{     !< String to scan}}
\DoxyCodeLine{247   \textcolor{keywordtype}{character(len=*)},   \textcolor{keywordtype}{intent(in)} :: separators\textcolor{comment}{ !< Characters to use for delineation}}
\DoxyCodeLine{248   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)} :: n\textcolor{comment}{          !< Number of word to extract}}
\DoxyCodeLine{249   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional},  \textcolor{keywordtype}{intent(in)} :: missing\_value\textcolor{comment}{ !< Value to assign if word is missing}}
\DoxyCodeLine{250   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{251   \textcolor{keywordtype}{integer} :: ns, i, b, e, nw}
\DoxyCodeLine{252   \textcolor{keywordtype}{character(len=20)} :: word}
\DoxyCodeLine{253 }
\DoxyCodeLine{254   word = extract\_word(string, separators, n)}
\DoxyCodeLine{255 }
\DoxyCodeLine{256   \textcolor{keywordflow}{if} (len\_trim(word)>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{257     \textcolor{keyword}{read}(word(1:len\_trim(word)),*) extract\_integer}
\DoxyCodeLine{258   \textcolor{keywordflow}{else}}
\DoxyCodeLine{259     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(missing\_value)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{260       extract\_integer = missing\_value}
\DoxyCodeLine{261     \textcolor{keywordflow}{else}}
\DoxyCodeLine{262       extract\_integer = 0}
\DoxyCodeLine{263 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{264 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{265 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_a2f700337c5cf4e70a48bd0663570484e}\label{namespacemom__string__functions_a2f700337c5cf4e70a48bd0663570484e}} 
\index{mom\_string\_functions@{mom\_string\_functions}!extract\_real@{extract\_real}}
\index{extract\_real@{extract\_real}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{extract\_real()}{extract\_real()}}
{\footnotesize\ttfamily real function, public mom\+\_\+string\+\_\+functions\+::extract\+\_\+real (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{string,  }\item[{character(len=$\ast$), intent(in)}]{separators,  }\item[{integer, intent(in)}]{n,  }\item[{real, intent(in), optional}]{missing\+\_\+value }\end{DoxyParamCaption})}



Returns the real corresponding to the nth word in the argument. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em string} & String to scan \\
\hline
\mbox{\texttt{ in}}  & {\em separators} & Characters to use for delineation \\
\hline
\mbox{\texttt{ in}}  & {\em n} & Number of word to extract \\
\hline
\mbox{\texttt{ in}}  & {\em missing\+\_\+value} & Value to assign if word is missing \\
\hline
\end{DoxyParams}


Definition at line 269 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{270   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: string\textcolor{comment}{     !< String to scan}}
\DoxyCodeLine{271   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: separators\textcolor{comment}{ !< Characters to use for delineation}}
\DoxyCodeLine{272   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{intent(in)} :: n\textcolor{comment}{          !< Number of word to extract}}
\DoxyCodeLine{273 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional},   \textcolor{keywordtype}{intent(in)} :: missing\_value\textcolor{comment}{ !< Value to assign if word is missing}}
\DoxyCodeLine{274   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{275   \textcolor{keywordtype}{integer} :: ns, i, b, e, nw}
\DoxyCodeLine{276   \textcolor{keywordtype}{character(len=20)} :: word}
\DoxyCodeLine{277 }
\DoxyCodeLine{278   word = extract\_word(string, separators, n)}
\DoxyCodeLine{279 }
\DoxyCodeLine{280   \textcolor{keywordflow}{if} (len\_trim(word)>0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{281     \textcolor{keyword}{read}(word(1:len\_trim(word)),*) extract\_real}
\DoxyCodeLine{282   \textcolor{keywordflow}{else}}
\DoxyCodeLine{283     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(missing\_value)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{284       extract\_real = missing\_value}
\DoxyCodeLine{285     \textcolor{keywordflow}{else}}
\DoxyCodeLine{286       extract\_real = 0}
\DoxyCodeLine{287 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{288 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{289 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_aad76dee92b69dab4488da049fe11cdb8}\label{namespacemom__string__functions_aad76dee92b69dab4488da049fe11cdb8}} 
\index{mom\_string\_functions@{mom\_string\_functions}!extract\_word@{extract\_word}}
\index{extract\_word@{extract\_word}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{extract\_word()}{extract\_word()}}
{\footnotesize\ttfamily character(len=120) function, public mom\+\_\+string\+\_\+functions\+::extract\+\_\+word (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{string,  }\item[{character(len=$\ast$), intent(in)}]{separators,  }\item[{integer, intent(in)}]{n }\end{DoxyParamCaption})}



Returns the string corresponding to the nth word in the argument or \char`\"{}\char`\"{} if the string is not long enough. Words are delineated by the mandatory separators argument. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em string} & String to scan \\
\hline
\mbox{\texttt{ in}}  & {\em separators} & Characters to use for delineation \\
\hline
\mbox{\texttt{ in}}  & {\em n} & Number of word to extract \\
\hline
\end{DoxyParams}


Definition at line 208 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{209   \textcolor{keywordtype}{character(len=*)},   \textcolor{keywordtype}{intent(in)} :: string\textcolor{comment}{     !< String to scan}}
\DoxyCodeLine{210   \textcolor{keywordtype}{character(len=*)},   \textcolor{keywordtype}{intent(in)} :: separators\textcolor{comment}{ !< Characters to use for delineation}}
\DoxyCodeLine{211   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)} :: n\textcolor{comment}{          !< Number of word to extract}}
\DoxyCodeLine{212   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{213   \textcolor{keywordtype}{integer} :: ns, i, b, e, nw}
\DoxyCodeLine{214   \textcolor{keywordtype}{logical} :: lastCharIsSeperator}
\DoxyCodeLine{215   extract\_word = \textcolor{stringliteral}{''}}
\DoxyCodeLine{216   lastcharisseperator = .true.}
\DoxyCodeLine{217   ns = len\_trim(string)}
\DoxyCodeLine{218   i = 0; b=0; e=0; nw=0}
\DoxyCodeLine{219   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (i<ns)}
\DoxyCodeLine{220     i = i+1}
\DoxyCodeLine{221     \textcolor{keywordflow}{if} (lastcharisseperator) \textcolor{keywordflow}{then} \textcolor{comment}{! search for end of word}}
\DoxyCodeLine{222       \textcolor{keywordflow}{if} (verify(string(i:i),separators)==0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{223         \textcolor{keywordflow}{continue} \textcolor{comment}{! Multiple separators}}
\DoxyCodeLine{224       \textcolor{keywordflow}{else}}
\DoxyCodeLine{225         lastcharisseperator = .false. \textcolor{comment}{! character is beginning of word}}
\DoxyCodeLine{226         b = i}
\DoxyCodeLine{227         \textcolor{keywordflow}{continue}}
\DoxyCodeLine{228 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{229     \textcolor{keywordflow}{else} \textcolor{comment}{! continue search for end of word}}
\DoxyCodeLine{230       \textcolor{keywordflow}{if} (verify(string(i:i),separators)==0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{231         lastcharisseperator = .true.}
\DoxyCodeLine{232         e = i-\/1 \textcolor{comment}{! Previous character is end of word}}
\DoxyCodeLine{233         nw = nw+1}
\DoxyCodeLine{234         \textcolor{keywordflow}{if} (nw==n) \textcolor{keywordflow}{then}}
\DoxyCodeLine{235           extract\_word = trim(string(b:e))}
\DoxyCodeLine{236           \textcolor{keywordflow}{return}}
\DoxyCodeLine{237 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{238 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{239 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{240 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{241   \textcolor{keywordflow}{if} (b<=ns .and. nw==n-\/1) extract\_word = trim(string(b:ns))}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_a7bfdab6bba33230cc94ed625e95022c9}\label{namespacemom__string__functions_a7bfdab6bba33230cc94ed625e95022c9}} 
\index{mom\_string\_functions@{mom\_string\_functions}!extractword@{extractword}}
\index{extractword@{extractword}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{extractword()}{extractword()}}
{\footnotesize\ttfamily character(len=120) function, public mom\+\_\+string\+\_\+functions\+::extractword (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{string,  }\item[{integer, intent(in)}]{n }\end{DoxyParamCaption})}



Returns the string corresponding to the nth word in the argument or \char`\"{}\char`\"{} if the string is not long enough. Both spaces and commas are interpreted as separators. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em string} & The string to scan \\
\hline
\mbox{\texttt{ in}}  & {\em n} & Number of word to extract \\
\hline
\end{DoxyParams}


Definition at line 197 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{198   \textcolor{keywordtype}{character(len=*)},   \textcolor{keywordtype}{intent(in)} :: string\textcolor{comment}{ !< The string to scan}}
\DoxyCodeLine{199   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)} :: n\textcolor{comment}{      !< Number of word to extract}}
\DoxyCodeLine{200 }
\DoxyCodeLine{201   extractword = extract\_word(string, \textcolor{stringliteral}{' ,'}, n)}
\DoxyCodeLine{202 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_aec369a6ac0badc1dbd782a1668d2c7c3}\label{namespacemom__string__functions_aec369a6ac0badc1dbd782a1668d2c7c3}} 
\index{mom\_string\_functions@{mom\_string\_functions}!isformattedfloatequalto@{isformattedfloatequalto}}
\index{isformattedfloatequalto@{isformattedfloatequalto}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{isformattedfloatequalto()}{isformattedfloatequalto()}}
{\footnotesize\ttfamily logical function mom\+\_\+string\+\_\+functions\+::isformattedfloatequalto (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{str,  }\item[{real, intent(in)}]{val }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Returns True if the string can be read/parsed to give the exact value of \char`\"{}val\char`\"{}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em str} & The string to parse \\
\hline
\mbox{\texttt{ in}}  & {\em val} & The real value to compare with \\
\hline
\end{DoxyParams}


Definition at line 181 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{182   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: str\textcolor{comment}{ !< The string to parse}}
\DoxyCodeLine{183 \textcolor{keywordtype}{  real},             \textcolor{keywordtype}{intent(in)} :: val\textcolor{comment}{ !< The real value to compare with}}
\DoxyCodeLine{184   \textcolor{keywordtype}{logical}                      :: isFormattedFloatEqualTo}
\DoxyCodeLine{185   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{186 \textcolor{keywordtype}{  real} :: scannedVal}
\DoxyCodeLine{187 }
\DoxyCodeLine{188   isformattedfloatequalto=.false.}
\DoxyCodeLine{189   \textcolor{keyword}{read}(str(1:),*,err=987) scannedval}
\DoxyCodeLine{190   \textcolor{keywordflow}{if} (scannedval == val) isformattedfloatequalto=.true.}
\DoxyCodeLine{191  987 \textcolor{keywordflow}{return}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_ae6b4260129cce257d834cc9b32e847f3}\label{namespacemom__string__functions_ae6b4260129cce257d834cc9b32e847f3}} 
\index{mom\_string\_functions@{mom\_string\_functions}!left\_int@{left\_int}}
\index{left\_int@{left\_int}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{left\_int()}{left\_int()}}
{\footnotesize\ttfamily character(len=19) function, public mom\+\_\+string\+\_\+functions\+::left\+\_\+int (\begin{DoxyParamCaption}\item[{integer, intent(in)}]{i }\end{DoxyParamCaption})}



Returns a character string of a left-\/formatted integer e.\+g. \char`\"{}123       \char`\"{} (assumes 19 digit maximum) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em i} & The integer to convert to a string \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The output string 
\end{DoxyReturn}


Definition at line 61 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{62   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: i\textcolor{comment}{ !< The integer to convert to a string}}
\DoxyCodeLine{63   \textcolor{keywordtype}{character(len=19)} :: left\_int\textcolor{comment}{ !< The output string}}
\DoxyCodeLine{64 }
\DoxyCodeLine{65   \textcolor{keywordtype}{character(len=19)} :: tmp}
\DoxyCodeLine{66   \textcolor{keyword}{write}(tmp(1:19),\textcolor{stringliteral}{'(I19)'}) i}
\DoxyCodeLine{67   \textcolor{keyword}{write}(left\_int(1:19),\textcolor{stringliteral}{'(A)'}) adjustl(tmp)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_a0db6538cb622d0f20a577b07cb545f2e}\label{namespacemom__string__functions_a0db6538cb622d0f20a577b07cb545f2e}} 
\index{mom\_string\_functions@{mom\_string\_functions}!left\_ints@{left\_ints}}
\index{left\_ints@{left\_ints}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{left\_ints()}{left\_ints()}}
{\footnotesize\ttfamily character(len=1320) function, public mom\+\_\+string\+\_\+functions\+::left\+\_\+ints (\begin{DoxyParamCaption}\item[{integer, dimension(\+:), intent(in)}]{i }\end{DoxyParamCaption})}



Returns a character string of a comma-\/separated, compact formatted, integers e.\+g. \char`\"{}1, 2, 3, 4\char`\"{}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em i} & The array of integers to convert to a string \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The output string 
\end{DoxyReturn}


Definition at line 72 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{73   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: i(:)\textcolor{comment}{ !< The array of integers to convert to a string}}
\DoxyCodeLine{74   \textcolor{keywordtype}{character(len=1320)} :: left\_ints\textcolor{comment}{ !< The output string}}
\DoxyCodeLine{75 }
\DoxyCodeLine{76   \textcolor{keywordtype}{character(len=1320)} :: tmp}
\DoxyCodeLine{77   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{78   \textcolor{keyword}{write}(left\_ints(1:1320),\textcolor{stringliteral}{'(A)'}) trim(left\_int(i(1)))}
\DoxyCodeLine{79   \textcolor{keywordflow}{if} (\textcolor{keyword}{size}(i)>1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{80     \textcolor{keywordflow}{do} j=2,\textcolor{keyword}{size}(i)}
\DoxyCodeLine{81       tmp=left\_ints}
\DoxyCodeLine{82       \textcolor{keyword}{write}(left\_ints(1:1320),\textcolor{stringliteral}{'(A,", ",A)'}) trim(tmp),trim(left\_int(i(j)))}
\DoxyCodeLine{83 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{84 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_ab56b89fb51a387279afc68c85d30dca2}\label{namespacemom__string__functions_ab56b89fb51a387279afc68c85d30dca2}} 
\index{mom\_string\_functions@{mom\_string\_functions}!left\_real@{left\_real}}
\index{left\_real@{left\_real}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{left\_real()}{left\_real()}}
{\footnotesize\ttfamily character(len=32) function, public mom\+\_\+string\+\_\+functions\+::left\+\_\+real (\begin{DoxyParamCaption}\item[{real, intent(in)}]{val }\end{DoxyParamCaption})}



Returns a left-\/justified string with a real formatted like \textquotesingle{}(G)\textquotesingle{}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em val} & The real variable to convert to a string \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The output string 
\end{DoxyReturn}


Definition at line 88 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{89 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)}  :: val\textcolor{comment}{ !< The real variable to convert to a string}}
\DoxyCodeLine{90   \textcolor{keywordtype}{character(len=32)} :: left\_real\textcolor{comment}{ !< The output string}}
\DoxyCodeLine{91 }
\DoxyCodeLine{92   \textcolor{keywordtype}{integer} :: l, ind}
\DoxyCodeLine{93 }
\DoxyCodeLine{94   \textcolor{keywordflow}{if} ((abs(val) < 1.0e4) .and. (abs(val) >= 1.0e-\/3)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{95     \textcolor{keyword}{write}(left\_real, \textcolor{stringliteral}{'(F30.11)'}) val}
\DoxyCodeLine{96     \textcolor{keywordflow}{if} (.not.isformattedfloatequalto(left\_real,val)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{97       \textcolor{keyword}{write}(left\_real, \textcolor{stringliteral}{'(F30.12)'}) val}
\DoxyCodeLine{98       \textcolor{keywordflow}{if} (.not.isformattedfloatequalto(left\_real,val)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{99         \textcolor{keyword}{write}(left\_real, \textcolor{stringliteral}{'(F30.13)'}) val}
\DoxyCodeLine{100         \textcolor{keywordflow}{if} (.not.isformattedfloatequalto(left\_real,val)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{101           \textcolor{keyword}{write}(left\_real, \textcolor{stringliteral}{'(F30.14)'}) val}
\DoxyCodeLine{102           \textcolor{keywordflow}{if} (.not.isformattedfloatequalto(left\_real,val)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{103             \textcolor{keyword}{write}(left\_real, \textcolor{stringliteral}{'(F30.15)'}) val}
\DoxyCodeLine{104             \textcolor{keywordflow}{if} (.not.isformattedfloatequalto(left\_real,val)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{105               \textcolor{keyword}{write}(left\_real, \textcolor{stringliteral}{'(F30.16)'}) val}
\DoxyCodeLine{106 \textcolor{keywordflow}{            endif}}
\DoxyCodeLine{107 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{108 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{109 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{110 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{111     \textcolor{keywordflow}{do}}
\DoxyCodeLine{112       l = len\_trim(left\_real)}
\DoxyCodeLine{113       \textcolor{keywordflow}{if} ((l<2) .or. (left\_real(l-\/1:l) == \textcolor{stringliteral}{".0"}) .or. \&}
\DoxyCodeLine{114           (left\_real(l:l) /= \textcolor{stringliteral}{"0"})) \textcolor{keywordflow}{exit}}
\DoxyCodeLine{115       left\_real(l:l) = \textcolor{stringliteral}{" "}}
\DoxyCodeLine{116 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{117   \textcolor{keywordflow}{elseif} (val == 0.) \textcolor{keywordflow}{then}}
\DoxyCodeLine{118     left\_real = \textcolor{stringliteral}{"0.0"}}
\DoxyCodeLine{119   \textcolor{keywordflow}{else}}
\DoxyCodeLine{120     \textcolor{keywordflow}{if} ((abs(val) <= 1.0e-\/100) .or. (abs(val) >= 1.0e100)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{121       \textcolor{keyword}{write}(left\_real(1:32), \textcolor{stringliteral}{'(ES24.14E3)'}) val}
\DoxyCodeLine{122       \textcolor{keywordflow}{if} (.not.isformattedfloatequalto(left\_real,val)) \&}
\DoxyCodeLine{123         \textcolor{keyword}{write}(left\_real(1:32), \textcolor{stringliteral}{'(ES24.15E3)'}) val}
\DoxyCodeLine{124     \textcolor{keywordflow}{else}}
\DoxyCodeLine{125       \textcolor{keyword}{write}(left\_real(1:32), \textcolor{stringliteral}{'(ES23.14)'}) val}
\DoxyCodeLine{126       \textcolor{keywordflow}{if} (.not.isformattedfloatequalto(left\_real,val)) \&}
\DoxyCodeLine{127         \textcolor{keyword}{write}(left\_real(1:32), \textcolor{stringliteral}{'(ES23.15)'}) val}
\DoxyCodeLine{128 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{129     \textcolor{keywordflow}{do}}
\DoxyCodeLine{130       ind = index(left\_real,\textcolor{stringliteral}{"0E"})}
\DoxyCodeLine{131       \textcolor{keywordflow}{if} (ind == 0) \textcolor{keywordflow}{exit}}
\DoxyCodeLine{132       \textcolor{keywordflow}{if} (left\_real(ind-\/1:ind-\/1) == \textcolor{stringliteral}{"."}) \textcolor{keywordflow}{exit}}
\DoxyCodeLine{133       left\_real = left\_real(1:ind-\/1)//left\_real(ind+1:)}
\DoxyCodeLine{134 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{135 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{136   left\_real = adjustl(left\_real)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_a07fa1b92ce5c4c4336bb45c5a89fa548}\label{namespacemom__string__functions_a07fa1b92ce5c4c4336bb45c5a89fa548}} 
\index{mom\_string\_functions@{mom\_string\_functions}!left\_reals@{left\_reals}}
\index{left\_reals@{left\_reals}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{left\_reals()}{left\_reals()}}
{\footnotesize\ttfamily character(len=1320) function, public mom\+\_\+string\+\_\+functions\+::left\+\_\+reals (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{r,  }\item[{character(len=$\ast$), intent(in), optional}]{sep }\end{DoxyParamCaption})}



Returns a character string of a comma-\/separated, compact formatted, reals e.\+g. \char`\"{}1., 2., 5$\ast$3., 5.\+E2\char`\"{}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em r} & The array of real variables to convert to a string \\
\hline
\mbox{\texttt{ in}}  & {\em sep} & The separator between successive values, by default it is \textquotesingle{}, \textquotesingle{}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The output string 
\end{DoxyReturn}


Definition at line 141 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{142 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)} :: r(:)\textcolor{comment}{ !< The array of real variables to convert to a string}}
\DoxyCodeLine{143   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: sep\textcolor{comment}{ !< The separator between}}
\DoxyCodeLine{144 \textcolor{comment}{                                    !! successive values, by default it is ', '.}}
\DoxyCodeLine{145   \textcolor{keywordtype}{character(len=1320)} :: left\_reals\textcolor{comment}{ !< The output string}}
\DoxyCodeLine{146 }
\DoxyCodeLine{147   \textcolor{keywordtype}{integer} :: j, n, b, ns}
\DoxyCodeLine{148   \textcolor{keywordtype}{logical} :: doWrite}
\DoxyCodeLine{149   \textcolor{keywordtype}{character(len=10)} :: separator}
\DoxyCodeLine{150 }
\DoxyCodeLine{151   n=1 ; dowrite=.true. ; left\_reals=\textcolor{stringliteral}{''} ; b=1}
\DoxyCodeLine{152   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(sep)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{153     separator=sep ; ns=len(sep)}
\DoxyCodeLine{154   \textcolor{keywordflow}{else}}
\DoxyCodeLine{155     separator=\textcolor{stringliteral}{', '} ; ns=2}
\DoxyCodeLine{156 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{157   \textcolor{keywordflow}{do} j=1,\textcolor{keyword}{size}(r)}
\DoxyCodeLine{158     dowrite=.true.}
\DoxyCodeLine{159     \textcolor{keywordflow}{if} (j<\textcolor{keyword}{size}(r)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{160       \textcolor{keywordflow}{if} (r(j)==r(j+1)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{161         n=n+1}
\DoxyCodeLine{162         dowrite=.false.}
\DoxyCodeLine{163 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{164 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{165     \textcolor{keywordflow}{if} (dowrite) \textcolor{keywordflow}{then}}
\DoxyCodeLine{166       \textcolor{keywordflow}{if} (b>1) \textcolor{keywordflow}{then} \textcolor{comment}{! Write separator if a number has already been written}}
\DoxyCodeLine{167         \textcolor{keyword}{write}(left\_reals(b:),\textcolor{stringliteral}{'(A)'}) separator}
\DoxyCodeLine{168         b=b+ns}
\DoxyCodeLine{169 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{170       \textcolor{keywordflow}{if} (n>1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{171         \textcolor{keyword}{write}(left\_reals(b:),\textcolor{stringliteral}{'(A,"*",A)'}) trim(left\_int(n)),trim(left\_real(r(j)))}
\DoxyCodeLine{172       \textcolor{keywordflow}{else}}
\DoxyCodeLine{173         \textcolor{keyword}{write}(left\_reals(b:),\textcolor{stringliteral}{'(A)'}) trim(left\_real(r(j)))}
\DoxyCodeLine{174 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{175       n=1 ; b=len\_trim(left\_reals)+1}
\DoxyCodeLine{176 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{177 \textcolor{keywordflow}{  enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_a1ca01e01cf691da9ea4dd5c20ad81770}\label{namespacemom__string__functions_a1ca01e01cf691da9ea4dd5c20ad81770}} 
\index{mom\_string\_functions@{mom\_string\_functions}!localtesti@{localtesti}}
\index{localtesti@{localtesti}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{localtesti()}{localtesti()}}
{\footnotesize\ttfamily logical function mom\+\_\+string\+\_\+functions\+::localtesti (\begin{DoxyParamCaption}\item[{logical, intent(in)}]{verbose,  }\item[{integer, intent(in)}]{i1,  }\item[{integer, intent(in)}]{i2 }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



True if i1 is not equal to i2. False otherwise. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em verbose} & If true, write results to stdout \\
\hline
\mbox{\texttt{ in}}  & {\em i1} & Integer \\
\hline
\mbox{\texttt{ in}}  & {\em i2} & Integer \\
\hline
\end{DoxyParams}


Definition at line 375 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{376   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)} :: verbose\textcolor{comment}{ !< If true, write results to stdout}}
\DoxyCodeLine{377   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: i1\textcolor{comment}{ !< Integer}}
\DoxyCodeLine{378   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: i2\textcolor{comment}{ !< Integer}}
\DoxyCodeLine{379   localtesti=.false.}
\DoxyCodeLine{380   \textcolor{keywordflow}{if} (i1/=i2) localtesti=.true.}
\DoxyCodeLine{381   \textcolor{keywordflow}{if} (localtesti .or. verbose) \textcolor{keywordflow}{then}}
\DoxyCodeLine{382     \textcolor{keyword}{write}(stdout,*) i1,i2}
\DoxyCodeLine{383     \textcolor{keywordflow}{if} (localtesti) \textcolor{keywordflow}{then}}
\DoxyCodeLine{384       \textcolor{keyword}{write}(stdout,*) i1,\textcolor{stringliteral}{'!='},i2, \textcolor{stringliteral}{'<-\/-\/ FAIL'}}
\DoxyCodeLine{385       \textcolor{keyword}{write}(stderr,*) i1,\textcolor{stringliteral}{'!='},i2, \textcolor{stringliteral}{'<-\/-\/ FAIL'}}
\DoxyCodeLine{386 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{387 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_a7ed3314f4fae014b9c35c321320063b2}\label{namespacemom__string__functions_a7ed3314f4fae014b9c35c321320063b2}} 
\index{mom\_string\_functions@{mom\_string\_functions}!localtestr@{localtestr}}
\index{localtestr@{localtestr}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{localtestr()}{localtestr()}}
{\footnotesize\ttfamily logical function mom\+\_\+string\+\_\+functions\+::localtestr (\begin{DoxyParamCaption}\item[{logical, intent(in)}]{verbose,  }\item[{real, intent(in)}]{r1,  }\item[{real, intent(in)}]{r2 }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



True if r1 is not equal to r2. False otherwise. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em verbose} & If true, write results to stdout \\
\hline
\mbox{\texttt{ in}}  & {\em r1} & Float \\
\hline
\mbox{\texttt{ in}}  & {\em r2} & Float \\
\hline
\end{DoxyParams}


Definition at line 391 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{392   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)} :: verbose\textcolor{comment}{ !< If true, write results to stdout}}
\DoxyCodeLine{393 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)} :: r1\textcolor{comment}{ !< Float}}
\DoxyCodeLine{394 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)} :: r2\textcolor{comment}{ !< Float}}
\DoxyCodeLine{395   localtestr=.false.}
\DoxyCodeLine{396   \textcolor{keywordflow}{if} (r1/=r2) localtestr=.true.}
\DoxyCodeLine{397   \textcolor{keywordflow}{if} (localtestr .or. verbose) \textcolor{keywordflow}{then}}
\DoxyCodeLine{398     \textcolor{keyword}{write}(stdout,*) r1,r2}
\DoxyCodeLine{399     \textcolor{keywordflow}{if} (localtestr) \textcolor{keywordflow}{then}}
\DoxyCodeLine{400       \textcolor{keyword}{write}(stdout,*) r1,\textcolor{stringliteral}{'!='},r2, \textcolor{stringliteral}{'<-\/-\/ FAIL'}}
\DoxyCodeLine{401       \textcolor{keyword}{write}(stderr,*) r1,\textcolor{stringliteral}{'!='},r2, \textcolor{stringliteral}{'<-\/-\/ FAIL'}}
\DoxyCodeLine{402 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{403 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_a3f4583fac417ae45e370035ce0eecb04}\label{namespacemom__string__functions_a3f4583fac417ae45e370035ce0eecb04}} 
\index{mom\_string\_functions@{mom\_string\_functions}!localtests@{localtests}}
\index{localtests@{localtests}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{localtests()}{localtests()}}
{\footnotesize\ttfamily logical function mom\+\_\+string\+\_\+functions\+::localtests (\begin{DoxyParamCaption}\item[{logical, intent(in)}]{verbose,  }\item[{character(len=$\ast$), intent(in)}]{str1,  }\item[{character(len=$\ast$), intent(in)}]{str2 }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



True if str1 does not match str2. False otherwise. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em verbose} & If true, write results to stdout \\
\hline
\mbox{\texttt{ in}}  & {\em str1} & String \\
\hline
\mbox{\texttt{ in}}  & {\em str2} & String \\
\hline
\end{DoxyParams}


Definition at line 359 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{360   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)} :: verbose\textcolor{comment}{ !< If true, write results to stdout}}
\DoxyCodeLine{361   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: str1\textcolor{comment}{ !< String}}
\DoxyCodeLine{362   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: str2\textcolor{comment}{ !< String}}
\DoxyCodeLine{363   localtests=.false.}
\DoxyCodeLine{364   \textcolor{keywordflow}{if} (trim(str1)/=trim(str2)) localtests=.true.}
\DoxyCodeLine{365   \textcolor{keywordflow}{if} (localtests .or. verbose) \textcolor{keywordflow}{then}}
\DoxyCodeLine{366     \textcolor{keyword}{write}(stdout,*) \textcolor{stringliteral}{'>'}//trim(str1)//\textcolor{stringliteral}{'<'}}
\DoxyCodeLine{367     \textcolor{keywordflow}{if} (localtests) \textcolor{keywordflow}{then}}
\DoxyCodeLine{368       \textcolor{keyword}{write}(stdout,*) trim(str1),\textcolor{stringliteral}{':'},trim(str2), \textcolor{stringliteral}{'<-\/-\/ FAIL'}}
\DoxyCodeLine{369       \textcolor{keyword}{write}(stderr,*) trim(str1),\textcolor{stringliteral}{':'},trim(str2), \textcolor{stringliteral}{'<-\/-\/ FAIL'}}
\DoxyCodeLine{370 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{371 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_a4d76e9e8c2cd53f210b02006924a9212}\label{namespacemom__string__functions_a4d76e9e8c2cd53f210b02006924a9212}} 
\index{mom\_string\_functions@{mom\_string\_functions}!lowercase@{lowercase}}
\index{lowercase@{lowercase}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{lowercase()}{lowercase()}}
{\footnotesize\ttfamily character(len=len(input\+\_\+string)) function, public mom\+\_\+string\+\_\+functions\+::lowercase (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{input\+\_\+string }\end{DoxyParamCaption})}



Return a string in which all uppercase letters have been replaced by their lowercase counterparts. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em input\+\_\+string} & The string to modify \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The modified output string 
\end{DoxyReturn}


Definition at line 25 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{26   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{intent(in)} :: input\_string\textcolor{comment}{ !< The string to modify}}
\DoxyCodeLine{27   \textcolor{keywordtype}{character(len=len(input\_string))} :: lowercase\textcolor{comment}{ !< The modified output string}}
\DoxyCodeLine{28 \textcolor{comment}{!   This function returns a string in which all uppercase letters have been}}
\DoxyCodeLine{29 \textcolor{comment}{! replaced by their lowercase counterparts.  It is loosely based on the}}
\DoxyCodeLine{30 \textcolor{comment}{! lowercase function in mpp\_util.F90.}}
\DoxyCodeLine{31   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{parameter} :: co=iachar(\textcolor{stringliteral}{'a'})-\/iachar(\textcolor{stringliteral}{'A'}) \textcolor{comment}{! case offset}}
\DoxyCodeLine{32   \textcolor{keywordtype}{integer} :: k}
\DoxyCodeLine{33 }
\DoxyCodeLine{34   lowercase = input\_string}
\DoxyCodeLine{35   \textcolor{keywordflow}{do} k=1, len\_trim(input\_string)}
\DoxyCodeLine{36     \textcolor{keywordflow}{if} (lowercase(k:k) >= \textcolor{stringliteral}{'A'} .and. lowercase(k:k) <= \textcolor{stringliteral}{'Z'}) \&}
\DoxyCodeLine{37         lowercase(k:k) = achar(ichar(lowercase(k:k))+co)}
\DoxyCodeLine{38 \textcolor{keywordflow}{  enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_a60262e56f544e4613754df43bf50652e}\label{namespacemom__string__functions_a60262e56f544e4613754df43bf50652e}} 
\index{mom\_string\_functions@{mom\_string\_functions}!remove\_spaces@{remove\_spaces}}
\index{remove\_spaces@{remove\_spaces}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{remove\_spaces()}{remove\_spaces()}}
{\footnotesize\ttfamily character(len=120) function, public mom\+\_\+string\+\_\+functions\+::remove\+\_\+spaces (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{string }\end{DoxyParamCaption})}



Returns string with all spaces removed. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em string} & String to scan \\
\hline
\end{DoxyParams}


Definition at line 293 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{294   \textcolor{keywordtype}{character(len=*)},   \textcolor{keywordtype}{intent(in)} :: string\textcolor{comment}{     !< String to scan}}
\DoxyCodeLine{295   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{296   \textcolor{keywordtype}{integer} :: ns, i, o}
\DoxyCodeLine{297   \textcolor{keywordtype}{logical} :: lastCharIsSeperator}
\DoxyCodeLine{298   lastcharisseperator = .true.}
\DoxyCodeLine{299   ns = len\_trim(string)}
\DoxyCodeLine{300   i = 0; o = 0}
\DoxyCodeLine{301   \textcolor{keywordflow}{do} \textcolor{keywordflow}{while} (i<ns)}
\DoxyCodeLine{302     i = i+1}
\DoxyCodeLine{303     \textcolor{keywordflow}{if} (string(i:i) /= \textcolor{stringliteral}{' '}) \textcolor{keywordflow}{then} \textcolor{comment}{! Copy character to output string}}
\DoxyCodeLine{304       o = o + 1}
\DoxyCodeLine{305       remove\_spaces(o:o) = string(i:i)}
\DoxyCodeLine{306 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{307 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{308   \textcolor{keywordflow}{do} i = o+1, 120}
\DoxyCodeLine{309     remove\_spaces(i:i) = \textcolor{stringliteral}{' '} \textcolor{comment}{! Wipe any non-\/empty characters}}
\DoxyCodeLine{310 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{311   remove\_spaces = trim(remove\_spaces)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_af18b819f6c6a917c57b9690d0580f642}\label{namespacemom__string__functions_af18b819f6c6a917c57b9690d0580f642}} 
\index{mom\_string\_functions@{mom\_string\_functions}!slasher@{slasher}}
\index{slasher@{slasher}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{slasher()}{slasher()}}
{\footnotesize\ttfamily character(len=len(dir)+2) function, public mom\+\_\+string\+\_\+functions\+::slasher (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{dir }\end{DoxyParamCaption})}



Returns a directory name that is terminated with a \char`\"{}/\char`\"{} or \char`\"{}./\char`\"{} if the argument is an empty string. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em dir} & A directory to be terminated with a \char`\"{}/\char`\"{} or changed to \char`\"{}./\char`\"{} if it is blank. \\
\hline
\end{DoxyParams}


Definition at line 408 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{409   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{intent(in)} :: dir\textcolor{comment}{ !< A directory to be terminated with a "/"}}
\DoxyCodeLine{410 \textcolor{comment}{                                      !! or changed to "./" if it is blank.}}
\DoxyCodeLine{411   \textcolor{keywordtype}{character(len=len(dir)+2)} :: slasher}
\DoxyCodeLine{412 }
\DoxyCodeLine{413   \textcolor{keywordflow}{if} (len\_trim(dir) == 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{414     slasher = \textcolor{stringliteral}{"./"}}
\DoxyCodeLine{415   \textcolor{keywordflow}{elseif} (dir(len\_trim(dir):len\_trim(dir)) == \textcolor{stringliteral}{'/'}) \textcolor{keywordflow}{then}}
\DoxyCodeLine{416     slasher = trim(dir)}
\DoxyCodeLine{417   \textcolor{keywordflow}{else}}
\DoxyCodeLine{418     slasher = trim(dir)//\textcolor{stringliteral}{"/"}}
\DoxyCodeLine{419 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_a7b7aa802a4da2021801267f6c6f890bf}\label{namespacemom__string__functions_a7b7aa802a4da2021801267f6c6f890bf}} 
\index{mom\_string\_functions@{mom\_string\_functions}!string\_functions\_unit\_tests@{string\_functions\_unit\_tests}}
\index{string\_functions\_unit\_tests@{string\_functions\_unit\_tests}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{string\_functions\_unit\_tests()}{string\_functions\_unit\_tests()}}
{\footnotesize\ttfamily logical function, public mom\+\_\+string\+\_\+functions\+::string\+\_\+functions\+\_\+unit\+\_\+tests (\begin{DoxyParamCaption}\item[{logical, intent(in)}]{verbose }\end{DoxyParamCaption})}



Returns true if a unit test of string\+\_\+functions fails. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em verbose} & If true, write results to stdout \\
\hline
\end{DoxyParams}


Definition at line 315 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{316   \textcolor{comment}{! Arguments}}
\DoxyCodeLine{317   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(in)} :: verbose\textcolor{comment}{ !< If true, write results to stdout}}
\DoxyCodeLine{318   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{319   \textcolor{keywordtype}{integer} :: i(5) = (/ -\/1, 1, 3, 3, 0 /)}
\DoxyCodeLine{320 \textcolor{keywordtype}{  real} :: r(8) = (/ 0., 1., -\/2., 1.3, 3.e-\/11, 3.e-\/11, 3.e-\/11, -\/5.1e12 /)}
\DoxyCodeLine{321   \textcolor{keywordtype}{logical} :: fail, v}
\DoxyCodeLine{322   fail = .false.}
\DoxyCodeLine{323   v = verbose}
\DoxyCodeLine{324   \textcolor{keyword}{write}(stdout,*) \textcolor{stringliteral}{'==== MOM\_string\_functions: string\_functions\_unit\_tests ==='}}
\DoxyCodeLine{325   fail = fail .or. localtests(v,left\_int(-\/1),\textcolor{stringliteral}{'-\/1'})}
\DoxyCodeLine{326   fail = fail .or. localtests(v,left\_ints(i(:)),\textcolor{stringliteral}{'-\/1, 1, 3, 3, 0'})}
\DoxyCodeLine{327   fail = fail .or. localtests(v,left\_real(0.),\textcolor{stringliteral}{'0.0'})}
\DoxyCodeLine{328   fail = fail .or. localtests(v,left\_reals(r(:)),\textcolor{stringliteral}{'0.0, 1.0, -\/2.0, 1.3, 3*3.0E-\/11, -\/5.1E+12'})}
\DoxyCodeLine{329   fail = fail .or. localtests(v,left\_reals(r(:),sep=\textcolor{stringliteral}{' '}),\textcolor{stringliteral}{'0.0 1.0 -\/2.0 1.3 3*3.0E-\/11 -\/5.1E+12'})}
\DoxyCodeLine{330   fail = fail .or. localtests(v,left\_reals(r(:),sep=\textcolor{stringliteral}{','}),\textcolor{stringliteral}{'0.0,1.0,-\/2.0,1.3,3*3.0E-\/11,-\/5.1E+12'})}
\DoxyCodeLine{331   fail = fail .or. localtests(v,extractword(\textcolor{stringliteral}{"One Two,Three"},1),\textcolor{stringliteral}{"One"})}
\DoxyCodeLine{332   fail = fail .or. localtests(v,extractword(\textcolor{stringliteral}{"One Two,Three"},2),\textcolor{stringliteral}{"Two"})}
\DoxyCodeLine{333   fail = fail .or. localtests(v,extractword(\textcolor{stringliteral}{"One Two,Three"},3),\textcolor{stringliteral}{"Three"})}
\DoxyCodeLine{334   fail = fail .or. localtests(v,extractword(\textcolor{stringliteral}{"One Two,  Three"},3),\textcolor{stringliteral}{"Three"})}
\DoxyCodeLine{335   fail = fail .or. localtests(v,extractword(\textcolor{stringliteral}{" One Two,Three"},1),\textcolor{stringliteral}{"One"})}
\DoxyCodeLine{336   fail = fail .or. localtests(v,extract\_word(\textcolor{stringliteral}{"One,Two,Three"},\textcolor{stringliteral}{","},3),\textcolor{stringliteral}{"Three"})}
\DoxyCodeLine{337   fail = fail .or. localtests(v,extract\_word(\textcolor{stringliteral}{"One,Two,Three"},\textcolor{stringliteral}{","},4),\textcolor{stringliteral}{""})}
\DoxyCodeLine{338   fail = fail .or. localtests(v,remove\_spaces(\textcolor{stringliteral}{"1 2 3"}),\textcolor{stringliteral}{"123"})}
\DoxyCodeLine{339   fail = fail .or. localtests(v,remove\_spaces(\textcolor{stringliteral}{" 1 2 3"}),\textcolor{stringliteral}{"123"})}
\DoxyCodeLine{340   fail = fail .or. localtests(v,remove\_spaces(\textcolor{stringliteral}{"1 2 3 "}),\textcolor{stringliteral}{"123"})}
\DoxyCodeLine{341   fail = fail .or. localtests(v,remove\_spaces(\textcolor{stringliteral}{"123"}),\textcolor{stringliteral}{"123"})}
\DoxyCodeLine{342   fail = fail .or. localtests(v,remove\_spaces(\textcolor{stringliteral}{" "}),\textcolor{stringliteral}{""})}
\DoxyCodeLine{343   fail = fail .or. localtests(v,remove\_spaces(\textcolor{stringliteral}{""}),\textcolor{stringliteral}{""})}
\DoxyCodeLine{344   fail = fail .or. localtesti(v,extract\_integer(\textcolor{stringliteral}{"1"},\textcolor{stringliteral}{""},1),1)}
\DoxyCodeLine{345   fail = fail .or. localtesti(v,extract\_integer(\textcolor{stringliteral}{"1,2,3"},\textcolor{stringliteral}{","},1),1)}
\DoxyCodeLine{346   fail = fail .or. localtesti(v,extract\_integer(\textcolor{stringliteral}{"1,2"},\textcolor{stringliteral}{","},2),2)}
\DoxyCodeLine{347   fail = fail .or. localtesti(v,extract\_integer(\textcolor{stringliteral}{"1,2"},\textcolor{stringliteral}{","},3),0)}
\DoxyCodeLine{348   fail = fail .or. localtesti(v,extract\_integer(\textcolor{stringliteral}{"1,2"},\textcolor{stringliteral}{","},4,4),4)}
\DoxyCodeLine{349   fail = fail .or. localtestr(v,extract\_real(\textcolor{stringliteral}{"1."},\textcolor{stringliteral}{""},1),1.)}
\DoxyCodeLine{350   fail = fail .or. localtestr(v,extract\_real(\textcolor{stringliteral}{"1.,2.,3."},\textcolor{stringliteral}{","},1),1.)}
\DoxyCodeLine{351   fail = fail .or. localtestr(v,extract\_real(\textcolor{stringliteral}{"1.,2."},\textcolor{stringliteral}{","},2),2.)}
\DoxyCodeLine{352   fail = fail .or. localtestr(v,extract\_real(\textcolor{stringliteral}{"1.,2."},\textcolor{stringliteral}{","},3),0.)}
\DoxyCodeLine{353   fail = fail .or. localtestr(v,extract\_real(\textcolor{stringliteral}{"1.,2."},\textcolor{stringliteral}{","},4,4.),4.)}
\DoxyCodeLine{354   \textcolor{keywordflow}{if} (.not. fail) \textcolor{keyword}{write}(stdout,*) \textcolor{stringliteral}{'Pass'}}
\DoxyCodeLine{355   string\_functions\_unit\_tests = fail}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__string__functions_aca148baf726de2f028b7e7baad3c85d4}\label{namespacemom__string__functions_aca148baf726de2f028b7e7baad3c85d4}} 
\index{mom\_string\_functions@{mom\_string\_functions}!uppercase@{uppercase}}
\index{uppercase@{uppercase}!mom\_string\_functions@{mom\_string\_functions}}
\doxysubsubsection{\texorpdfstring{uppercase()}{uppercase()}}
{\footnotesize\ttfamily character(len=len(input\+\_\+string)) function, public mom\+\_\+string\+\_\+functions\+::uppercase (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{input\+\_\+string }\end{DoxyParamCaption})}



Return a string in which all uppercase letters have been replaced by their lowercase counterparts. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em input\+\_\+string} & The string to modify \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The modified output string 
\end{DoxyReturn}


Definition at line 43 of file M\+O\+M\+\_\+string\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{44   \textcolor{keywordtype}{character(len=*)},     \textcolor{keywordtype}{intent(in)} :: input\_string\textcolor{comment}{ !< The string to modify}}
\DoxyCodeLine{45   \textcolor{keywordtype}{character(len=len(input\_string))} :: uppercase\textcolor{comment}{ !< The modified output string}}
\DoxyCodeLine{46 \textcolor{comment}{!   This function returns a string in which all lowercase letters have been}}
\DoxyCodeLine{47 \textcolor{comment}{! replaced by their uppercase counterparts.  It is loosely based on the}}
\DoxyCodeLine{48 \textcolor{comment}{! uppercase function in mpp\_util.F90.}}
\DoxyCodeLine{49   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{parameter} :: co=iachar(\textcolor{stringliteral}{'A'})-\/iachar(\textcolor{stringliteral}{'a'}) \textcolor{comment}{! case offset}}
\DoxyCodeLine{50   \textcolor{keywordtype}{integer} :: k}
\DoxyCodeLine{51 }
\DoxyCodeLine{52   uppercase = input\_string}
\DoxyCodeLine{53   \textcolor{keywordflow}{do} k=1, len\_trim(input\_string)}
\DoxyCodeLine{54     \textcolor{keywordflow}{if} (uppercase(k:k) >= \textcolor{stringliteral}{'a'} .and. uppercase(k:k) <= \textcolor{stringliteral}{'z'}) \&}
\DoxyCodeLine{55         uppercase(k:k) = achar(ichar(uppercase(k:k))+co)}
\DoxyCodeLine{56 \textcolor{keywordflow}{  enddo}}

\end{DoxyCode}
