3 import flash
.utils
.Dictionary;
12 public static function capitalize
(s
:String):String
14 return s
.substr
(0,1).toUpperCase
() + s
.substr
(1);
18 * a/an, depending on input
22 public static function A
(hurr
:String, caps
:Boolean = false):String {
23 var firstchar
:String = hurr
.substr
(0, 1);
25 return A
(hurr
.substr
(1));
26 if (firstchar
.toLowerCase
() in ["a", "e", "i", "o", "u"])
27 return (caps
)?"An":"an";
28 return (caps
)?"A":"a";
31 // Strip stuff like a/an
32 public static function stripA
(hurr
:String):String {
33 if (hurr
.substr
(0, 3).toLowerCase
() == "an ")
34 return hurr
.substring
(4);
35 if (hurr
.substr
(0, 2).toLowerCase
() == "a ")
36 return hurr
.substring
(3);
40 public static function nTh
(n
:Number):String {
41 if (n
== 1) return n
+ "st";
42 if (n
== 2) return n
+ "nd";
43 if (n
== 3) return n
+ "rd";
48 public static function dictLength
(myDictionary
:Dictionary):int
51 for (var key
:* in myDictionary
) {
58 public static function objHas
(o
:Object,key
:String):Boolean
60 for (var k
:String in o
) {
68 public static function pluralize
(num
:Number,t
:String,tp
:String=null):String {
73 if (t
.substr
(t
.length
- 1) == "y") {
74 return t
.substr
(0, t
.length
- 1) + "ies";