Follow-up Comment #2, bug #60802 (project groff): In the email list where this was reported, Brandon Robinson asked for (1) a unit test for the boundary conditions of the .substring request and (2) a precise description of its slicing semantics in our documentation.
Here is a first crack at those. Please see attached shell script which runs a regression test (which currently fails because .substring does not yet behave in the way expected). Here is a revised description of desired behavior: .substring xx n1 n2 Replace string xx with the substring defined by zero-based indicies n1 and n2. Or, put another way, delete any characters outside the range (n1..n2). If n2 is omitted then all characters after index n1 are included in the substring. If n1 > n2 or if n1 equals the length of the string, then nothing is selected and the string is set to empty if it was not already empty. Behavior is undefined if n1 > (n2+1) or if either index is negative. (file #51644) _______________________________________________________ Additional Item Attachment: File name: substring_test.bash Size:2 KB <https://file.savannah.gnu.org/file/substring_test.bash?file_id=51644> _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?60802> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/