retrieving substring with negative index, or equivalent.
na <[email protected]>
| Newsgroups | gmane.comp.gnu.m4.general |
|---|---|
| Message-ID | <CAF5U=ueZOEvvmBowKGEuGzaXpyAJ_WLAf4N=MVnrbUjkcVW-6A@mail.gmail.com> |
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.