\pdfretval vs. expandable \pdfstrcmp
![](https://secure.gravatar.com/avatar/c4fb1aecd98bbaa9856f8c421db294e0.jpg?s=120&d=mm&r=g)
Hello,
is there a reason why \pdfstrcmp is not expandable?
An expandable variant could be used in expandable contexts:
\ifcase\numexpr\pdfstrcmp{StringA}{StringB}+1\relax
...\or ...\or ...\fi
Inserting into a sorted linear list could be done in O(n):
\edef\mylist{\addtolist\mylist{foo}}%
Now it is O(n^2) :-(
Yours sincerely
Heiko
![](https://secure.gravatar.com/avatar/58cce501a997822a0cb6051496d1b0c8.jpg?s=120&d=mm&r=g)
the reason is the same like in case of \pdfescapestr: I don't know tex the program well enough to make them expandable, so just made a quick hack to get it work. Anyone willing to improve them is welcome very much. Regards, Thanh On Wed, Jun 15, 2005 at 08:41:48PM +0200, Heiko Oberdiek wrote:
Hello,
is there a reason why \pdfstrcmp is not expandable? An expandable variant could be used in expandable contexts: \ifcase\numexpr\pdfstrcmp{StringA}{StringB}+1\relax ...\or ...\or ...\fi Inserting into a sorted linear list could be done in O(n): \edef\mylist{\addtolist\mylist{foo}}% Now it is O(n^2) :-(
Yours sincerely Heiko
-- _______________________________________________ ntg-pdftex mailing list ntg-pdftex@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-pdftex
participants (2)
-
Heiko Oberdiek
-
The Thanh Han