[OS X TeX] ifthen and regular expressions

Friedrich Vosberg fvosberg at mac.com
Wed May 23 15:59:06 EDT 2007


Am 15.05.2007 um 17.11 schrieb Jeffrey J Weimer:
>
> On May 15, 2007, at 7:13 AM, Friedrich Vosberg wrote:
>
>> Does someone of You know how to get an ifthenelse switch that is  
>> TRUE if the expansion of the given macro contains a given string.  
>> For example:
>>
>> \def\string{court}
>> \def\pattern{Royal High Court of Westminster}
>>
>> \ifthenelse{contains{\string}{\pattern}{%
>>   TRUE
>> }{%
>>   FALSE
>> }
>
> The coolstr package may be able to handle this.

It seems You are all right, but I don not find the matching values.

===== 8>< =====
\documentclass{ltxdoc}
\usepackage{coolstr}
\begin{document}
\ifstrchareq{The Royal Court of Westminster}{0}{Court}{%
   TRUE
}{%
   FALSE
}
\end{document}
===== ><8 =====

I do not understand which value is needed in \ifstrchareq for the  
second argument.

Any hints?

TIA and kind regards, Friedrich

--
»We have to expect it, otherwise we would be surprised.«
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the MacOSX-TeX mailing list