Hi ulrich, > > -- Request: .substring str n1 [n2] > > Replace the string named STR with the substring defined by the > > indices N1 and N2. The first character in the string has index 0. > > If N2 is omitted, it is taken to be equal to the string's length. > > shouldn't that be "it is taken to be equal to the string's length - 1" > ? (As we count from zero.)
That's how substring_request() works it out. http://git.savannah.gnu.org/cgit/groff.git/tree/src/roff/troff/input.cpp#n4777 int end = -1; if (!has_arg() || get_integer(&end)) { ... if (start < 0) start += real_length; if (end < 0) end += real_length; if (start > end) { int tem = start; start = end; end = tem; } "If N2 is omitted, the index of xx's last character is used."? Cheers, Ralph.