[texhax] The last character of a string
Uwe Lück
uwe.lueck at web.de
Sat Jan 30 17:15:19 CET 2010
At 20:26 29.01.10, Donald Arseneau wrote:
>Michael Barr <barr at math.mcgill.ca> writes:
>
> > Is there a simple way to find the last character of a string?
>
>You have to scan through the tokens from first to last.
Sometimes I think you don't read my postings (I may know why, sometimes you
gave the same advice that I gave earlier). I demonstrated how to test
whether a certain token is the the last one without scanning the list.
> > What I want to do is add a period unless the string already
> > ends in a period, question mark, or exclamation mark,
>
>Oh that's easy -- check the value of \spacefactor.
>Easy, but not 100% reliable.
That's right! Even if you prefer \frenchspacing, you can assign a
\spacefactor of 1001 to the dot etc.
Cheers,
Uwe.
More information about the texhax
mailing list