Array sorting 101

BlitzMax Forums/BlitzMax Programming/Array sorting 101

Method Compare:Int(withObject:Object)
	Local other:TCar=TCar(withObject)
	If other=Self Return 0
	If other<>Null
		Local clr1$=color.ToLower()
		Local clr2$=other.color.ToLower()
		For Local i:Int=0 To Min(clr1.length,clr2.length)-1
			If clr1[i]=clr2[i] Continue
			If clr1[i]>clr2[i] Return 1
			Return -1
		Next
		If clr1.length=clr2.length Return 0
		If clr1.length>clr2.length Return 1
		Return -1
	Else
		Return 1
	EndIf
End Method

Add this to TCar.
Look under Language->Objects for the documentation on the Compare method. I actually had no idea that Sort() was an array method until I saw that example.