sorting associative array's keys by values

Jonathan M Davis jmdavisProg at gmx.com
Sat Jun 16 17:01:27 PDT 2012


On Sunday, June 17, 2012 01:35:56 maarten van damme wrote:
> It should allways contain </html> so it has more then 2 elements and
> there is a note section that starts with "<div class" where I stop
> parsing and break out of the loop so those two should've been
> statisfied. The problem was (I think) the downloader. Now I get waaay
> less frequent crashes (yes, there is still a little bug somewhere but
> I'll catch it)

It _should_ always have </html>, but that string is input from outside the 
program under which you have no control, so you need to check it or at least 
check that any find or similar function that you use which can return an 
invalid index when </html> isn't there doesn't return an invalid index. 
Otherwise, you're going to get RangeErrors when it isn't there. Array slicing 
assumes that you've checked beforehand that the indices are valid, and it's a 
bug in your program if they're not.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list