D - [bug] Using a single-character string in std.string.rfind
- J C Calvarese (14/14) Dec 21 2003 I found a problem in std.string.rfind when a single-character string is
I found a problem in std.string.rfind when a single-character string is used, an "Error: ArrayBoundsError string(413)" is produced. I know if I used a character literal the problem goes away, but I still think this is a hole that should be plugged. I came up with a two-line fix for rfind(char[], char[]) in string.d that might be a good way to fix it: if (sub.length == 1) return rfind(s, sub[0]); I'm sure there's another way to fix it, but this is the first one I found. The file rfind_char.d shows the Phobos problem, and when it's compiled with "-version=fix", my fix is shown. -- Justin http://jcc_7.tripod.com/d/
Dec 21 2003