groff
[Top][All Lists]
Advanced

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

Re: [groff] Changing A Defined String


From: Robert Thorsby
Subject: Re: [groff] Changing A Defined String
Date: Mon, 29 Jan 2018 08:26:31 +1100

Tadziu asked me to post my solution, so here goes. Essentially, I searched sequentially for ", "; the successful result gave me their position in the string. The four levels of search were brought about by the fact that in the English names for the days of the week three have 6 characters, one has 7, two have 8, and one has 9.

Note, the nonce variable FIND*COMMA must be redefined at the commencement of each level of the search; I suppose I should have deleted it at the end.

Thanks to all for your interest and suggestions,
Robert

.ds DATE*FULL Monday, 29 January 2018
.\" Do NOT amend the following by hand.
.\" The variables will be created automagically.
.\" The RHS (date) of the second line of the Header Continuation text.
.  ds DATE*SHORT \*[DATE*FULL]
.  ds FIND*COMMA \*[DATE*FULL]
.  substring FIND*COMMA 6 7
.  ie '\*[FIND*COMMA]', ' .substring DATE*SHORT 8
.  el \{\
.    ds FIND*COMMA \*[DATE*FULL]
.    substring FIND*COMMA 7 8
.    ie '\*[FIND*COMMA]', ' .substring DATE*SHORT 9
.    el \{\
.      ds FIND*COMMA \*[DATE*FULL]
.      substring FIND*COMMA 8 9
.      ie '\*[FIND*COMMA]', ' .substring DATE*SHORT 10
.      el \{\
.        ds FIND*COMMA \*[DATE*FULL]
.        substring FIND*COMMA 9 10
.        if '\*[FIND*COMMA]', ' .substring DATE*SHORT 11
.      \}
.    \}
.  \}


reply via email to

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