diff options
author | Karl Berry <karl@freefriends.org> | 2015-02-03 23:42:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-02-03 23:42:38 +0000 |
commit | 0c94de6b806ddf6d4728555897667610f0a3de55 (patch) | |
tree | 467f2c61598c838aa91b167ba791789c2a994894 /Master/texmf-dist/source/latex/stringstrings | |
parent | 5186e33c6d218e9003f3da20bedfa840c1765d27 (diff) |
stringstrings (3feb15)
git-svn-id: svn://tug.org/texlive/trunk@36203 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/stringstrings')
-rw-r--r-- | Master/texmf-dist/source/latex/stringstrings/stringstrings.dtx | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/Master/texmf-dist/source/latex/stringstrings/stringstrings.dtx b/Master/texmf-dist/source/latex/stringstrings/stringstrings.dtx index 6d9ffa57194..24baeeda9c6 100644 --- a/Master/texmf-dist/source/latex/stringstrings/stringstrings.dtx +++ b/Master/texmf-dist/source/latex/stringstrings/stringstrings.dtx @@ -1,6 +1,6 @@ % \iffalse %<package>\ProvidesPackage{stringstrings} -%<package>[2013/04/24 v1.22 +%<package>[2015/02/02 v1.23 %<package> Extensive array of string manipulation routines for %<package> cosmetic and programming application] %<package>\NeedsTeXFormat{LaTeX2e} @@ -30,6 +30,9 @@ % v1.20 -Added ability to encode/decode arbitrary tokens % v1.21 -Added %, removing extra space (bug) from \whereisword % v1.22 -Added %, removing extra space (bug) from \getargs +% v1.23 -Changed {~} to {\ } in \retokenizechar +% -Forced all stringtest commands to function outside of math mode +% which will give correct result, when invoked within math mode. \documentclass{ltxdoc} \usepackage{stringstrings} \DisableCrossrefs @@ -2804,6 +2807,7 @@ % RESULT STORED IN BOOLEAN \ifmatchingchar \newif\ifmatchingchar \newcommand\testmatchingchar[3]{% + \setbox0=\hbox{% % \end{macrocode} % Extract desired character from test string % \begin{macrocode} @@ -2829,15 +2833,15 @@ % No, we are comparing a normal character against a multi-byte symbol % (apples and oranges), a false comparison. % \begin{macrocode} - \matchingcharfalse% + \global\matchingcharfalse% \fi \else % \end{macrocode} % No, we are comparing two normal one-byte characters, not a mult-byte % character. % \begin{macrocode} - \if \thestring#3\matchingchartrue\else\matchingcharfalse\fi - \fi + \if \thestring#3\global\matchingchartrue\else\global\matchingcharfalse\fi + \fi} \?} % \end{macrocode} % \end{macro} @@ -2850,6 +2854,7 @@ % \begin{macrocode} \newif\ifcapitalized \newcommand\testcapitalized[1]{\+% + \setbox0=\hbox{% \isnextbyte[q]{\EscapeChar}{#1}% \if T\theresult% \def\EncodingTreatment{e}% @@ -2888,7 +2893,7 @@ % altered the string % \begin{macrocode} \ifthenelse{\equal{\@stringA}{\@stringB}}% - {\capitalizedfalse}{\capitalizedtrue}\?% + {\global\capitalizedfalse}{\global\capitalizedtrue}}\?% \defaultTreatments% } % \end{macrocode} @@ -2901,6 +2906,7 @@ % \begin{macrocode} \newif\ifuncapitalized \newcommand\testuncapitalized[1]{\+% + \setbox0=\hbox{% \isnextbyte[q]{\EscapeChar}{#1}% \if T\theresult% \def\EncodingTreatment{e}% @@ -2918,7 +2924,7 @@ \edef\@stringB{\@rotate{#1}}% \fi \ifthenelse{\equal{\@stringA}{\@stringB}}% - {\uncapitalizedfalse}{\uncapitalizedtrue}\?% + {\global\uncapitalizedfalse}{\global\uncapitalizedtrue}}\?% \defaultTreatments% } % \end{macrocode} @@ -2955,6 +2961,7 @@ % \begin{macrocode} \newif\ifuppercase \newcommand\testuppercase[1]{% + \setbox0=\hbox{% % \end{macrocode} % Strip all non-alphabetic characters. Save as |\@stringA|. % \begin{macrocode} @@ -2977,13 +2984,13 @@ % \begin{macrocode} \@getstringlength{\@stringA}{@stringsize}% \ifthenelse{\value{@stringsize} = 0}% - {\uppercasefalse}{\uppercasetrue}% + {\global\uppercasefalse}{\global\uppercasetrue}% }% % \end{macrocode} % If strings are not equal, then the alphabetic characters of the % original string were not all uppercase. Test false. % \begin{macrocode} - {\uppercasefalse}% + {\global\uppercasefalse}}% \defaultTreatments% } % \end{macrocode} @@ -2996,6 +3003,7 @@ % \begin{macrocode} \newif\ifsolelyuppercase \newcommand\testsolelyuppercase[1]{% + \setbox0=\hbox{% \stringencode{#1}% \edef\@stringA{\thestring}% \solelyuppercase[e]{#1}% @@ -3005,9 +3013,9 @@ \noblanks[q]{\@stringA}% \@getstringlength{\thestring}{@stringsize}% \ifthenelse{\value{@stringsize} = 0}% - {\solelyuppercasefalse}{\solelyuppercasetrue}% + {\global\solelyuppercasefalse}{\global\solelyuppercasetrue}% }% - {\solelyuppercasefalse}% + {\global\solelyuppercasefalse}}% \defaultTreatments% } % \end{macrocode} @@ -3019,19 +3027,20 @@ % \begin{macrocode} \newif\iflowercase \newcommand\testlowercase[1]{% + \setbox0=\hbox{% \Treatments{1}{1}{0}{0}{0}{0}% \substring[e]{#1}{1}{\@MAXSTRINGSIZE}% \edef\@stringA{\thestring}% \def\AlphaCapsTreatment{2}% \substring[e]{#1}{1}{\@MAXSTRINGSIZE}% \edef\@stringB{\thestring}% - \ifthenelse{\equal{\@stringA}{\@stringB}}% + \ifthenelse{\equal{\@stringA}{\@stringB}}% {% \@getstringlength{\@stringA}{@stringsize}% - \ifthenelse{\value{@stringsize} = 0}% - {\lowercasefalse}{\lowercasetrue}% + \ifnum\value{@stringsize}= 0\relax% + \global\lowercasefalse\else\global\lowercasetrue\fi% }% - {\lowercasefalse}% + {\global\lowercasefalse}}% \defaultTreatments% } % \end{macrocode} @@ -3043,6 +3052,7 @@ % \begin{macrocode} \newif\ifsolelylowercase \newcommand\testsolelylowercase[1]{% + \setbox0=\hbox{% \stringencode{#1}% \edef\@stringA{\thestring}% \solelylowercase[e]{#1}% @@ -3052,9 +3062,9 @@ \noblanks[q]{\@stringA}% \@getstringlength{\thestring}{@stringsize}% \ifthenelse{\value{@stringsize} = 0}% - {\solelylowercasefalse}{\solelylowercasetrue}% + {\global\solelylowercasefalse}{\global\solelylowercasetrue}% }% - {\solelylowercasefalse}% + {\global\solelylowercasefalse}}% \defaultTreatments% } % \end{macrocode} @@ -3067,6 +3077,7 @@ % \begin{macrocode} \newif\ifalphabetic \newcommand\testalphabetic[1]{% + \setbox0=\hbox{% \stringencode{#1}% \edef\@stringA{\thestring}% \alphabetic[e]{#1}% @@ -3076,9 +3087,9 @@ \noblanks[q]{\@stringA}% \@getstringlength{\thestring}{@stringsize}% \ifthenelse{\value{@stringsize} = 0}% - {\alphabeticfalse}{\alphabetictrue}% + {\global\alphabeticfalse}{\global\alphabetictrue}% }% - {\alphabeticfalse}% + {\global\alphabeticfalse}}% \defaultTreatments% } % \end{macrocode} @@ -3334,7 +3345,7 @@ \expandafter\def\csname#2\endcsname{\%}\else \expandafter\ifx\expandafter\##1% \expandafter\def\csname#2\endcsname{\#}\else - \if\EncodedBlankSpace#1\expandafter\def\csname#2\endcsname{~}\else + \if\EncodedBlankSpace#1\expandafter\def\csname#2\endcsname{\ }\else \expandafter\edef\csname#2\endcsname{#1}% \fi \fi |