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