Sorting an Array

torhu fake at address.dude
Tue Jul 10 12:04:16 PDT 2007


okibi wrote:
> I couldn't get your function to compile. I get the following error:
> 
> Error: need 'this' to access member getNumericPart
> 
> On the line:
> 
> return getNumericPart(a)>getNumericPart(b);
> 
> Any ideas?

That's odd. Try this instead, maybe there's a conflict with the sort 
attribute.

    sort(array, function(char[] a, char[] b) {
      return getNumericPart(a)>getNumericPart(b);
    });


More information about the Digitalmars-d-learn mailing list