Hi Steffen,
> |I think his point is[.]
>
> No, it works fine in practice:
My snipped point still stands though, you can't use .substring to get a
zero-length string from a non-empty one.
> > > The current behaviour is an unusable mystery to me personally:
> > > how can you gain a subst
|I think his point is[.]
No, it works fine in practice:
CLEAN UP <\&Os\&>
1st substr <\&> (of <\&Os\&>)
1st substr starts with \&: <\&Os\&> new
2nd substr <\&> (of <\&Os\&>)
2nd substr ends with \&: <\&Os\&> new
CLEANUP RETURNS (for <\&Os\&>)
It was generated with this piece of c
Ingo Schwarze wrote:
|Steffen Nurpmeso wrote on Thu, Nov 20, 2014 at 11:45:04AM +0100:
|> Ingo Schwarze wrote:
|>> Steffen Nurpmeso wrote on Wed, Nov 19, 2014 at 06:09:08PM +0100:
|
|>>> For S-roff i will add a .substr request which takes an index and
|
|>> Please don't. That is completel
Ingo Schwarze wrote:
> > While that is true... The current behaviour is an unusable
> > mystery to me personally: how can you gain a substring of length
> > null,
>
> .rm myname
> .ds myname ""
This defines " for myname.
> .ds myname \&
But
.ds myname
could be added to the list.
BTW
> If the colon is given then either or both of the indices can
> be omitted.
I see. So negative indices are a convenience, but index
computation is probably best done using positive indices
because coding the special case would be more awkward:
i = ... (index counting backward)
j = ... (oth
Hi Tadziu,
> > second parameter that gives an empty string, unlike the
> > [startindex, endindex) interval where endindex is exclusive,
> > e.g. Python.
>
> But that's not to say that the python way is in any way
> more intuitive or useful. Example:
>
> >>> print [1,2,3,4,5,6,7,8][-1]
> --
> second parameter that gives an empty string, unlike the
> [startindex, endindex) interval where endindex is exclusive,
> e.g. Python.
But that's not to say that the python way is in any way
more intuitive or useful. Example:
>>> print [1,2,3,4,5,6,7,8][-1]
--> 8
>>> print [1,2,3,4,5,
Hi Ingo,
> > for example, and without introducing lengthy calculations
>
> Lengthy? If you have the offset and length (> 0), all it takes is one
> addition and decrementing by one.
I think his point is given string s of `abcdefghij', one wants the
substring starting at index 2, `c', of length 0
Hi Steffen,
Steffen Nurpmeso wrote on Thu, Nov 20, 2014 at 11:45:04AM +0100:
> Ingo Schwarze wrote:
>> Steffen Nurpmeso wrote on Wed, Nov 19, 2014 at 06:09:08PM +0100:
>>> For S-roff i will add a .substr request which takes an index and
>> Please don't. That is completely equivalent and trivia
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
Hallo,
Ingo Schwarze wrote:
|Steffen Nurpmeso wrote on Wed, Nov 19, 2014 at 06:09:08PM +0100:
|> Ingo Schwarze wrote:
|>> Tadziu Hoffmann wrote on Wed, Nov 19, 2014 at 05:20:54PM +0100:
|>>> Steffen Nurpmeso wrote:
|>>> [snip]
|>>>
|>>> Where do you see a bug?
|>>>
|>>> man 7 groff:
Hallo all :),
Ingo Schwarze wrote:
|Tadziu Hoffmann wrote on Wed, Nov 19, 2014 at 05:20:54PM +0100:
|> Steffen Nurpmeso wrote:
|> [snip]
|
|> Where do you see a bug?
|>
|> man 7 groff:
|>
|> .substring xx n1 n2
|> Replace the string named xx with the substring defined by
|>
On Wed, Nov 19, 2014 at 05:24:22PM +, Ralph Corderoy wrote:
> Hi Steffen,
>
> > > > Replace the string named xx with the substring defined by
> > > > the indices n1 and n2.
> The full documentation of .substring wasn't originally given.
>
> -- Request: .substring str n1 [n2]
>
Tadziu Hoffmann wrote:
|> Hello: this is a bug?
|[snip]
|
|Where do you see a bug?
|
|man 7 groff:
|
| .substring xx n1 n2
|Replace the string named xx with the substring defined by
|the indices n1 and n2.
|
|groff:
|
|.ds x abc
|.substring x 0 1
|.tm \*x
|-->
Hi Ingo,
> you force every other implementation to follow, so everybody loses.
No, it might apply a little pressure to do so, but I'd assume groff and
most other implementations wouldn't follow. :-)
> While i like some aspects of Perl, lets not adopt the "there's more
> than one way to do it" a
Hi Steffen,
> > > Replace the string named xx with the substring defined by
> > > the indices n1 and n2.
> >
> > Maybe:
> >
> > Replace the string named xx with its substring beginning with
> > the zero-based index n1 and ending with index n2, inclusively.
>
> Inclusive index n2 of
Hi Steffen,
Steffen Nurpmeso wrote on Wed, Nov 19, 2014 at 06:09:08PM +0100:
> Ingo Schwarze wrote:
>> Tadziu Hoffmann wrote on Wed, Nov 19, 2014 at 05:20:54PM +0100:
>>> Steffen Nurpmeso wrote:
>>> [snip]
>>>
>>> Where do you see a bug?
>>>
>>> man 7 groff:
>>>
>>> .substring xx n1 n2
>>>
Hello: this is a bug?
$ print ".ds x abc\n.substring x 0 1\n.if '\*x'a' .tm x true for 0 1\n" |
troff -a
$ print ".ds x abc\n.substring x 0 0\n.if '\*x'a' .tm x true for 0 0\n" |
troff -a
x true for 0 0
--steffen
Hi,
Tadziu Hoffmann wrote on Wed, Nov 19, 2014 at 05:20:54PM +0100:
> Steffen Nurpmeso wrote:
>> Hello: this is a bug?
> [snip]
> Where do you see a bug?
>
> man 7 groff:
>
> .substring xx n1 n2
> Replace the string named xx with the substring defined by
> the indices n1 and n2.
The
> Hello: this is a bug?
[snip]
Where do you see a bug?
man 7 groff:
.substring xx n1 n2
Replace the string named xx with the substring defined by
the indices n1 and n2.
groff:
.ds x abc
.substring x 0 1
.tm \*x
--> ab
.ds x abc
.substring x 0 0
.tm \*x
--> a
20 matches
Mail list logo