2016-10-13 00:16:48 点击量:11 标签: 收藏本文
示例1:
- var vegetables:Array = new Array("spinach",
- "green pepper",
- "cilantro",
- "onion",
- "avocado");
- trace(vegetables); // spinach,green pepper,cilantro,onion,avocado
- vegetables.sort();
- trace(vegetables); // avocado,cilantro,green pepper,onion,spinach
示例2:
- var vegetables:Array = new Array("spinach",
- "green pepper",
- "Cilantro",
- "Onion",
- "Avocado");
- vegetables.sort();
- trace(vegetables); // Avocado,Cilantro,Onion,green pepper,spinach
- vegetables.sort(Array.CASEINSENSITIVE);
- trace(vegetables); // Avocado,Cilantro,green pepper,Onion,spinach
示例3:
- var vegetables:Array = new Array();
- vegetables.push(new Vegetable("lettuce", 1.49));
- vegetables.push(new Vegetable("spinach", 1.89));
- vegetables.push(new Vegetable("asparagus", 3.99));
- vegetables.push(new Vegetable("celery", 1.29));
- vegetables.push(new Vegetable("squash", 1.44));
- trace(vegetables);
- // lettuce:1.49, spinach:1.89, asparagus:3.99, celery:1.29, squash:1.44
- vegetables.sort();
- trace(vegetables);
- // asparagus:3.99, celery:1.29, lettuce:1.49, spinach:1.89, squash:1.44
- class Vegetable {
- private var name:String;
- private var price:Number;
- public function Vegetable(name:String, price:Number) {
- this.name = name;
- this.price = price;
- }
- public function toString():String {
- return " " + name + ":" + price;
- }
- }
我们是一家提供综合软件外包与弱电工程服务的技术公司。
业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。
公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室