Am 21.09.2013 um 19:11 schrieb Thangalin <thanga...@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
___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to