From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/92581 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: comparing strings Date: Thu, 17 Sep 2015 19:26:45 +0200 Message-ID: <55FAF7D5.8080409@gmail.com> References: <55FAEE8C.4060701@gmx.es> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0577683375==" X-Trace: ger.gmane.org 1442510870 26377 80.91.229.3 (17 Sep 2015 17:27:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 17 Sep 2015 17:27:50 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Sep 17 19:27:34 2015 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zccxy-0001mG-KY for gctc-ntg-context-518@m.gmane.org; Thu, 17 Sep 2015 19:27:26 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id ED15E10226 for ; Thu, 17 Sep 2015 19:27:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id sQlv7dt4EVJy for ; Thu, 17 Sep 2015 19:27:25 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 2246B10232 for ; Thu, 17 Sep 2015 19:26:58 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 60D26101F6 for ; Thu, 17 Sep 2015 19:26:54 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id w7cqNlLQO4Ln for ; Thu, 17 Sep 2015 19:26:48 +0200 (CEST) Original-Received: from filter4-ams.mf.surf.net (filter4-ams.mf.surf.net [192.87.102.72]) by balder.ntg.nl (Postfix) with ESMTP id CA656101E8 for ; Thu, 17 Sep 2015 19:26:48 +0200 (CEST) Original-Received: from mail-wi0-x22e.google.com (mail-wi0-x22e.google.com [IPv6:2a00:1450:400c:c05::22e]) by filter4-ams.mf.surf.net (8.14.4/8.14.4/Debian-4) with ESMTP id t8HHQlde018723 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2015 19:26:48 +0200 Original-Received: by wicge5 with SMTP id ge5so448069wic.0 for ; Thu, 17 Sep 2015 10:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=R9AbQh+/SeGSZAM9jzj8r2F0FrVA5aYDv5qu8cU8jqk=; b=qXLQ6qA437Go7FQfsVgyNQc+CUSnCO8YQ8/TF5KTU+mzGv7n46IgV2od8yLoxi/CqO VyV+fls/DvpddMDTVNPisBdc918OvcuZ0q6e3geAOXyMqT+s3ZXeGVbM0SQBSn8WaWBw JCN3RBjMeGVQqBaZMM1fsPyI27vNWdEupIKz+XH3/sT2I2XZAhaGA/pbCYh+T2vRPPnt MoHjn+scyDvy8vd7wc6qIijbQUqVbM0teS+ZJKnTC9A7R71QXy7n1+yqwO3pFC5zNpfK jOLkI2GCxqfeFne/Edav+hMKeM/e+JHhuoJcSNuiPc492x/TwylKDq49XAT6wvn5fXAo O/WQ== X-Received: by 10.180.107.193 with SMTP id he1mr30526486wib.81.1442510807687; Thu, 17 Sep 2015 10:26:47 -0700 (PDT) Original-Received: from keima.localdomain (x2f27b3b.dyn.telefonica.de. [2.242.123.59]) by smtp.googlemail.com with ESMTPSA id hr17sm11155500wib.16.2015.09.17.10.26.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Sep 2015 10:26:46 -0700 (PDT) User-Agent: Postbox 4.0.4 (Macintosh/20150825) In-Reply-To: <55FAEE8C.4060701@gmx.es> X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=2a00:1450:400c:c05::22e; country=BE; region=Brussels Capital; city=Brussels; latitude=50.8466; longitude=4.3528; http://maps.google.com/maps?q=50.8466,4.3528&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 01PihqMOT - ff2f31b4faf7 - 20150917 Received-SPF: pass (filter4-ams.mf.surf.net: domain of schuster.wolfgang@gmail.com designates 2a00:1450:400c:c05::22e as permitted sender) receiver=filter4-ams.mf.surf.net; client-ip=2a00:1450:400c:c05::22e; envelope-from=; helo=mail-wi0-x22e.google.com; identity=mailfrom X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:92581 Archived-At: This is a multi-part message in MIME format. --===============0577683375== Content-Type: multipart/alternative; boundary="------------080803070306050301030001" This is a multi-part message in MIME format. --------------080803070306050301030001 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable > Pablo Rodriguez > 17. September 2015 18:47 > Dear list, > > I have the following sample: > > \startluacode > function document.gouppercase(str) > tex.print(str:upper()) > end > \stopluacode > > \unexpanded\def\MyUpper#1% > {\ctxlua{document.gouppercase("#1")}} > > \starttext > \doif{\MyUpper{adfalkjfae=C3=B1f}}{\MyUpper{aDFAlkjfae=C3=B1f}}{equal}{= unequal} > > \ctxlua{if string.upper("adfalkjfae=C3=B1f") =3D=3D string.upper("aDFAl= kjfae=C3=B1f") > then tex.print("equal") else tex.print("unequal") end} > \stoptext > > Why are are the first two strings unequal? You can=E2=80=99t use a unexpandable (which you created with \unexpanded)= in=20 ConTeXts \doifXXX commands. PS. You need \doifelse and not \doif. Wolfgang --------------080803070306050301030001 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
17= .=20 September 2015 18:47
Dear list,

I have the following sample:

\startluac= ode
function document.gouppercase(str)
tex.print(str:upper())
end
\stopl= uacode

\unexpanded\def\MyUpper#1%
{\ctxlua{document.gouppercase("#1")}}

\starttext
\doif{\MyU= pper{adfalkjfae=C3=B1f}}{\MyUpper{aDFAlkjfae=C3=B1f}}{equal}{unequal}
=
\ctxlua{if string.upper("adfalkjfae=C3=B1f") =3D=3D string.upper("aDFAlkjfae=C3=B1f= ")
then=20 tex.print("equal") else tex.print("unequal") end}
\stoptext

Why are are the first two strings unequal?
You can=E2=80=99t use a unexpandable (which you created with \unexpanded)= in=20 ConTeXts \doifXXX commands.

PS. You need \doifelse and not \doif.

Wolfgang
--------------080803070306050301030001-- --===============0577683375== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============0577683375==--