POV-Ray : Newsgroups : povray.general : Doc bug - substr() : Re: Doc bug - substr() Server Time
8 Aug 2024 06:13:41 EDT (-0400)
  Re: Doc bug - substr()  
From: Geoff Wedig
Date: 22 Feb 2001 09:19:05
Message: <3a951fd9@news.povray.org>
Rune <run### [at] inamecom> wrote:

> In the POV-Ray documentation on the page about string functions the
> following is stated:

>> substr(S,P,L) Sub-string from S. Returns a string that is
>> a subset of the characters in parameter S starting at the
>> position specified by the integer value P for a length
>> specified by the integer value L. For example
>> substr("ABCDEFGHI",4,2) evaluates to the string "EF".
>> If P+L>strlen(S) an error occurs.

> However, there are two errors. The last but one line should read:

>> substr("ABCDEFGHI",4,2) evaluates to the string "DE".

> And the last line should read:

>> If P+L+1>strlen(S) an error occurs.

> Or something like that.

> Can anybody confirm?

> And is this a known bug?

This is C style, counting from 0 rather than 1, which is what arrays do. 
Have you tried the program to see what it does?  Does it count from 1 or 0? 
If it goes from 1, then I see it as a bug in the program, not the docs,
because it's inconsistent.

Speaking of manual bugs, can anyone confirm that the #range feature for
#switch is actually lower < value <= upper and not lower <= value <= upper
like it says in the manual?

Geoff


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.