While fiddling with character strings I found the \getfirstcharacter macro which is very handy. However, I am consuming a character string character by character. Although I have a macro for that, I think it is a good policy to stay as much as possible within the ConTexT framework when concocting macro's to be used under ConTeXt. Now for the question. \getfirstcharacter puts the first character in \firstcharacter. I looked for a macro containing the rest of the string but could not find one. Something like: \getfirstcharacter{abc} then \firstcharacter = a \lastcharacters = bc This will make it possible to process a string character by character, in the same way as \processcommalist does with comma separated strings. But possibly this is already somewhere in the code and I overlooked it. yours sincerely, dr. H. van der Meer
Hi Hans, I do not think it is available already, but it is very simple to patch the \getfirstcharacter macro: \def\dogetfirstcharacter#1#2\\% {\def\firstcharacter{#1}\def\remainingcharacters{#2}} (I like 'remaining' better than 'last') Cheers, taco
Taco Hoekwater wrote:
Hi Hans,
I do not think it is available already, but it is very simple to patch the \getfirstcharacter macro:
\def\dogetfirstcharacter#1#2\\% {\def\firstcharacter{#1}\def\remainingcharacters{#2}}
(I like 'remaining' better than 'last')
ok, patched Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Hans van der Meer
-
Taco Hoekwater