digitalmars.D.bugs - (check) ifind
- Carlos Santander B. (17/17) Feb 03 2005 Can somebody check this, please?
- Regan Heath (4/20) Feb 03 2005 Confirmed (DMD v0.112, compiler v0.111, WinXP Pro SP2).
- zwang (11/36) Feb 03 2005 It's a bug in std.string (line 571 - 597.)
- zwang (3/44) Feb 03 2005 A shorter test case: assert(ifind("00","01")<0);
Can somebody check this, please? //------------------------------ import std.string; import std.stdio; void main() { char [] str1="sus mejores cortesanos. Se embarcaron en el puerto de Dubai y"; char [] str2="page-break-before"; writefln(ifind(str1,str2)); } //------------------------------ The output I'm getting (DMD 0.112, WinXP Pro SP2) is (roll drums....) 45, when it should be -1. Why it's happening, I have no idea. find, rfind, irfind seem to work ok, but not ifind. _______________________ Carlos Santander Bernal
Feb 03 2005
On Thu, 03 Feb 2005 18:56:43 -0500, Carlos Santander B. <csantander619 gmail.com> wrote:Can somebody check this, please? //------------------------------ import std.string; import std.stdio; void main() { char [] str1="sus mejores cortesanos. Se embarcaron en el puerto de Dubai y"; char [] str2="page-break-before"; writefln(ifind(str1,str2)); } //------------------------------ The output I'm getting (DMD 0.112, WinXP Pro SP2) is (roll drums....) 45, when it should be -1.Confirmed (DMD v0.112, compiler v0.111, WinXP Pro SP2).Why it's happening, I have no idea. find, rfind, irfind seem to work ok, but not ifind.Regan
Feb 03 2005
It's a bug in std.string (line 571 - 597.) My quick fix goes here: 585c585 < break; ---return i;586a587return -1;595c596 < break; ---return i;596a598return -1;Carlos Santander B. wrote:Can somebody check this, please? //------------------------------ import std.string; import std.stdio; void main() { char [] str1="sus mejores cortesanos. Se embarcaron en el puerto de Dubai y"; char [] str2="page-break-before"; writefln(ifind(str1,str2)); } //------------------------------ The output I'm getting (DMD 0.112, WinXP Pro SP2) is (roll drums....) 45, when it should be -1. Why it's happening, I have no idea. find, rfind, irfind seem to work ok, but not ifind. _______________________ Carlos Santander Bernal
Feb 03 2005
A shorter test case: assert(ifind("00","01")<0); BTW, find, rfind, and irfind do not have this bug as far as i see. zwang wrote:It's a bug in std.string (line 571 - 597.) My quick fix goes here: 585c585 < break; --- > return i; 586a587 > return -1; 595c596 < break; --- > return i; 596a598 > return -1; Carlos Santander B. wrote:Can somebody check this, please? //------------------------------ import std.string; import std.stdio; void main() { char [] str1="sus mejores cortesanos. Se embarcaron en el puerto de Dubai y"; char [] str2="page-break-before"; writefln(ifind(str1,str2)); } //------------------------------ The output I'm getting (DMD 0.112, WinXP Pro SP2) is (roll drums....) 45, when it should be -1. Why it's happening, I have no idea. find, rfind, irfind seem to work ok, but not ifind. _______________________ Carlos Santander Bernal
Feb 03 2005