From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/84375 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: deeptextcommand and firstcharacter Date: Sat, 21 Sep 2013 19:43:04 +0200 Message-ID: <55EEA48B-263D-4956-9EAE-6FAB388430EC@gmail.com> References: <523D6D33.9060702@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Content-Type: multipart/mixed; boundary="===============1525744025==" X-Trace: ger.gmane.org 1379785389 10930 80.91.229.3 (21 Sep 2013 17:43:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Sep 2013 17:43:09 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Sep 21 19:43:10 2013 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 1VNRD1-00076M-AD for gctc-ntg-context-518@m.gmane.org; Sat, 21 Sep 2013 19:43:07 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 5576B101EA; Sat, 21 Sep 2013 19:41:05 +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 W-qEaZ7XAYSv; Sat, 21 Sep 2013 19:41:03 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 695E5101E5; Sat, 21 Sep 2013 19:41:03 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 42EFA101E5 for ; Sat, 21 Sep 2013 19:41:02 +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 6aFDoaXQXhD1 for ; Sat, 21 Sep 2013 19:41:01 +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 7EE8F10193 for ; Sat, 21 Sep 2013 19:41:01 +0200 (CEST) Original-Received: from mail-ea0-x234.google.com (mail-ea0-x234.google.com [IPv6:2a00:1450:4013:c01::234]) by filter4-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r8LHjRHW006409 for ; Sat, 21 Sep 2013 19:45:27 +0200 Original-Received: by mail-ea0-f180.google.com with SMTP id h10so860401eaj.25 for ; Sat, 21 Sep 2013 10:43:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:message-id:mime-version:subject:date:references :to:in-reply-to; bh=Gbjziws88NsOQT5Aeqmn2K4rJqoZ6d3Sg0ozFS/x0BM=; b=m449l8KlauaU2GSBBSyw/FusdVz2I4tz4EOmfPYUrnhAeeHD5Jit/d8F/5vFyX02CW jZIzZtRYiXheqS0XICuGLTjQHvaPVVNNoHSHKhY8HEmWmqf8s0ltOBpMllRvpm1QU1Mx CTguqSeFSAIvByQzOZ5R7hQ4m1OdKM26vxsAyCGcJmDeCkvmOhRhOyJz5UmDQM/gV44j xZ0gQpz0F2Xyf7dTDJeiyUNSpWNvLnLsGs+dZwJsWIvTkuSn12oZ7oCrdW4YFgCYeYzh DuRMH2lnrwBhA0QSnChFzAWcheKTTvPSvB96LNVXv+5KWATsZIceZiM+0aGT0gdjsZyr fyRw== X-Received: by 10.14.180.73 with SMTP id i49mr4807058eem.55.1379785381796; Sat, 21 Sep 2013 10:43:01 -0700 (PDT) Original-Received: from keima.localdomain (x2f21fe0.dyn.telefonica.de. [2.242.31.224]) by mx.google.com with ESMTPSA id r48sm28432446eev.14.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 21 Sep 2013 10:43:01 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.1510) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=2a00:1450:4013:c01::234; country=IE X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 01KrRJrRq - 30850d65e67c - 20130921 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 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-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:84375 Archived-At: --===============1525744025== Content-Type: multipart/alternative; boundary="Apple-Mail=_11230B97-765A-4BAC-8AD9-D0A13436E08D" --Apple-Mail=_11230B97-765A-4BAC-8AD9-D0A13436E08D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 Am 21.09.2013 um 19:11 schrieb Thangalin : > Hi, >=20 > Most programming languages allow extraction of a character or = substring from a string. For example, if I wanted to stylize the word = Index: >=20 > I... Index ...X >=20 > It would be handy to do something like: >=20 > \bold{\getcharacter[1]{#!}}... #1 = ...\bold{\getcharacter[\stringlength{#!}]} >=20 > That is a much more flexible solution than only providing a mechanism = to get the first character. >=20 > Is this possible? You can use Lua! \starttext \cldcontext{string.sub("A short example text!",0,1)} \cldcontext{string.sub("A short example text!",3,7)} \cldcontext{string.sub("A short example text!",-5)} \stoptext Wolfgang= --Apple-Mail=_11230B97-765A-4BAC-8AD9-D0A13436E08D Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=iso-8859-1
Am 21.09.2013 um 19:11 schrieb Thangalin <thangalin@gmail.com>:

Hi,

Most programming languages allow extraction of a character or substring from a string. For example, if I wanted to stylize the word Index:

I... Index ...X

It would be handy to do something like:

    \bold{\getcharacter[1]{#!}}... #1 ...\bold{\getcharacter[\stringlength{#!}]}

That is a much more flexible solution than only providing a mechanism to get the first character.

Is this possible?

You can use Lua!

\starttext
\cldcontext{string.sub("A short example text!",0,1)}
\cldcontext{string.sub("A short example text!",3,7)}
\cldcontext{string.sub("A short example text!",-5)}
\stoptext

Wolfgang
--Apple-Mail=_11230B97-765A-4BAC-8AD9-D0A13436E08D-- --===============1525744025== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============1525744025==--