Packageflare.util
Classpublic class Strings

Utility methods for working with String instances. The format method provides a powerful mechanism for formatting and templating strings.



Public Properties
 PropertyDefined by
  AD : String = "AD"
[static] String indicating "AD" time.
Strings
  AM1 : String = "A"
[static] Abbreviated string indicating "AM" time.
Strings
  AM2 : String = "AM"
[static] Full string indicating "AM" time.
Strings
  BC : String = "BC"
[static] String indicating "BC" time.
Strings
  DAY_ABBREVS : Array
[static] Array of abbreviated names for days of the week.
Strings
  DAY_NAMES : Array
[static] Array of full names for days of the week.
Strings
  DECIMAL_SEPARATOR : String = "."
[static] Separator for decimal (fractional) values.
Strings
  MONTH_ABBREVS : Array
[static] Array of abbreviated names for months of the year.
Strings
  MONTH_NAMES : Array
[static] Array of full names for months of the year.
Strings
  NaN : String = "NaN"
[static] String representing Not-a-Number (NaN).
Strings
  NEGATIVE_INFINITY : String = "-Inf"
[static] String representing negative infinity.
Strings
  PM1 : String = "P"
[static] Abbreviated string indicating "PM" time.
Strings
  PM2 : String = "PM"
[static] Full string indicating "PM" time.
Strings
  POSITIVE_INFINITY : String = "+Inf"
[static] String representing positive infinity.
Strings
  THOUSAND_SEPARATOR : String = ","
[static] Separator for thousands values.
Strings
Public Methods
 MethodDefined by
  
Constructor, throws an error if called, as this is an abstract class.
Strings
  
align(s:String, align:int):String
[static] Aligns a string by inserting padding space characters as needed.
Strings
  
format(fmt:String, ... args):String
[static] Outputs a formatted string using a set of input arguments and string formatting directives.
Strings
  
pad(x:Number, digits:int):String
[static] Pads a number with a specified number of "0" digits on the left-hand-side of the number.
Strings
  
padString(s:String, n:int):String
[static] Pads a string with zeroes up to given length.
Strings
  
repeat(s:String, reps:int):String
[static] Creates a new string by repeating an input string.
Strings
Public Constants
 ConstantDefined by
  DEFAULT_NUMBER : String = "0.########"
[static] Default formatting string for numbers.
Strings
Property detail
ADproperty
public static var AD:String = "AD"

String indicating "AD" time.

AM1property 
public static var AM1:String = "A"

Abbreviated string indicating "AM" time.

AM2property 
public static var AM2:String = "AM"

Full string indicating "AM" time.

BCproperty 
public static var BC:String = "BC"

String indicating "BC" time.

DAY_ABBREVSproperty 
public static var DAY_ABBREVS:Array

Array of abbreviated names for days of the week.

DAY_NAMESproperty 
public static var DAY_NAMES:Array

Array of full names for days of the week.

DECIMAL_SEPARATORproperty 
public static var DECIMAL_SEPARATOR:String = "."

Separator for decimal (fractional) values.

MONTH_ABBREVSproperty 
public static var MONTH_ABBREVS:Array

Array of abbreviated names for months of the year.

MONTH_NAMESproperty 
public static var MONTH_NAMES:Array

Array of full names for months of the year.

NaNproperty 
public static var NaN:String = "NaN"

String representing Not-a-Number (NaN).

NEGATIVE_INFINITYproperty 
public static var NEGATIVE_INFINITY:String = "-Inf"

String representing negative infinity.

PM1property 
public static var PM1:String = "P"

Abbreviated string indicating "PM" time.

PM2property 
public static var PM2:String = "PM"

Full string indicating "PM" time.

POSITIVE_INFINITYproperty 
public static var POSITIVE_INFINITY:String = "+Inf"

String representing positive infinity.

THOUSAND_SEPARATORproperty 
public static var THOUSAND_SEPARATOR:String = ","

Separator for thousands values.

Constructor detail
Strings()constructor
public function Strings()

Constructor, throws an error if called, as this is an abstract class.

Method detail
align()method
public static function align(s:String, align:int):String

Aligns a string by inserting padding space characters as needed.

Parameters
s:String — the string to align
 
align:int — an integer indicating both the desired length of the string (the absolute value of the input) and the alignment style (negative for left alignment, positive for right alignment)

Returns
String — the aligned string, padded or truncated as necessary
format()method 
public static function format(fmt:String, ... args):String

Outputs a formatted string using a set of input arguments and string formatting directives. This method uses the String formatting conventions of the .NET framework, providing a very flexible system for mapping input values into various string representations. For examples and reference documentation for string formatting options, see this example page or Microsoft's documentation.

Parameters
fmt:String — a formatting string. Format strings include markup indicating where input arguments should be placed in the string, along with optional formatting directives. For example, {1}, {0} writes out the second value argument, a comma, and then the first value argument.
 
... args — value arguments to be placed within the formatting string.

Returns
String — the formatted string.
pad()method 
public static function pad(x:Number, digits:int):String

Pads a number with a specified number of "0" digits on the left-hand-side of the number.

Parameters
x:Number — an input number
 
digits:int — the number of "0" digits to pad by

Returns
String — a padded string representation of the input number
padString()method 
public static function padString(s:String, n:int):String

Pads a string with zeroes up to given length.

Parameters
s:String — the string to pad
 
n:int — the target length of the padded string

Returns
String — the padded string. If the input string is already equal or longer than n characters it is returned unaltered. Otherwise, it is left-padded with zeroes up to form an n-character string.
repeat()method 
public static function repeat(s:String, reps:int):String

Creates a new string by repeating an input string.

Parameters
s:String — the string to repeat
 
reps:int — the number of times to repeat the string

Returns
String — a new String containing the repeated input
Constant detail
DEFAULT_NUMBERconstant
public static const DEFAULT_NUMBER:String = "0.########"

Default formatting string for numbers.