[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

retrieving substring with negative index, or equivalent.

From: na
Subject: retrieving substring with negative index, or equivalent.
Date: Tue, 9 Apr 2013 08:51:43 -0700

Is it possible to  take a string–e.g., s1 in define([s1],[body])–and print the substring starting from a negative index? The desired functionality is to get the substring of a macro definition starting from the end. So mysubstr(s1,-1) would give me `bod' dropping the y.

The most important thing I  want to be able to do is index the content of a macro starting from the end, not from the usual beginning. Another way to achieve this would be to create a macro that incrementally looks as the contents of s1, pushdef()'s a new macro with the contents of s1 in reverse–e.g., myreversestr(s1,s2) → define([s2],[ydob]). Either way, would work.

Thank you.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]