package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var bands:Array = ["C","W","L","T","A","r"];
bands.sort(bandNameSort);
for(var i:int = 0; i < bands.length; i++) {
trace(bands[i]);
}
function bandNameSort(band1:String, band2:String):int{
band1 = band1.toLowerCase( );
band2 = band2.toLowerCase( );
if(band1.substr(0, 4) == "the ") {
band1 = band1.substr(4);
}
if(band2.substr(0, 4) == "the ") {
band2 = band2.substr(4);
}
if(band1 < band2) {
return -1;
}
else {
return 1;
}
}
}
}
}
|