Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 04, 2005 (check) ifind | ||||
---|---|---|---|---|
| ||||
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 |
February 04, 2005 Re: (check) ifind | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | 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 |
February 04, 2005 Re: (check) ifind | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | 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
|
February 04, 2005 Re: (check) ifind | ||||
---|---|---|---|---|
| ||||
Posted in reply to zwang | 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
|
Copyright © 1999-2021 by the D Language Foundation