https://bugs.freedesktop.org/show_bug.cgi?id=87834
Bug ID: 87834
Summary: strange behavior of mid()-function
Product: LibreOffice
Version: unspecified
Hardware: Other
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: BASIC
Assignee: [email protected]
Reporter: [email protected]
Hello,
this is my first post - please be gentle if I do something wrong.
During programming I found that the mid()-function changes its bevahior. In LO
3 mid(Text T, Start) results an error if Start=0 and an empty string if Start
is negative or Start is larger then the length of the text T.
Now, tested in LO 4.2 and 4.3, mid(Text T, Start) results "!!br0ken!!" if Start
is negative or if Start is larger then the length of the string +1.
Examples:
mid("test",4) -> "t"
mid("test",5) -> ""
mid("test",6) -> "!!br0ken!!"
mid("test",-1) -> "!!br0ken!!"
mid("test",0) -> error
In the "Open Document Format for Office Applications (OpenDocument) Version
1.2" I found that the "normal" behavior should be:
Returns the characters from T, starting at character position Start, for up to
Length characters. For the integer conversions, Start=INT(Start), and
Length=INT(Length). If there are less than Length characters starting at start,
it returns as many characters as it can beginning with Start. In particular, if
Start > LEN(T), it returns the empty string (""). If Start < 0, it returns an
Error. If Start >=0, and Length=0, it returns the empty string. Note that
MID(T;1;Length) produces the same results as LEFT(T;Length).
Is the "new" behavior intended or is it a bug?
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs