[OS X TeX] trim a string

Michael Sharpe msharpe at ucsd.edu
Thu Apr 8 19:03:48 CEST 2010

On Apr 8, 2010, at 6:02 AM, RA Friedrich Vosberg wrote:

> Morning.
> I want to trim a string. Given is a macro that expands into a string, e.g. the path and name of a file (/Users/name/Documents/Clients/file.tex). I want to cut all characters on the left of /Documents.
> How can I achieve this?
> TIA and kind regards, Friedrich

If you can be certain that the string being cut contains the text at which you will cut it, the following will work. If not, the code needs to test some other possibilities.

\def\mycut#1#2{% #1=string to cut from, #2=leftmost substring at which to cut

For example





More information about the macostex-archives mailing list