Various helper functions placed in a Utility class.
Utility | Various helper functions placed in a Utility class. |
Functions | |
roundPoint | Helper for serialization to round points to 1 decimal place |
round2 | Rounds a numeric value to at most 2 digits after the decimal point. |
replaceAll | Search for a string of one or multiple characters, replace with another string of one or multiple chars. |
shrinkSequencesOf | Shrink all sequences of a given character in a string to one. |
beginsWith | Tests whether the string begins with the initial string. |
substrUntil | Returns a substring matching the part of string until the end token. |
trim | Trim whitespace from a string |
ltrim | Trim whitespace from left hand side of a string |
rtrim | Trim whitespace from right hand side of a string |
public static function replaceAll( str: String, sFind: String, sReplace: String ):String
Search for a string of one or multiple characters, replace with another string of one or multiple chars. Modelled after original AS1/2 code by Florian Kruesch.
str | string to be searched |
sFind | string to find |
sReplace | string to replace found string with |
A string with the search patterns replaced
Helper for serialization to round points to 1 decimal place
public static function roundPoint( value: Point ):Point
Rounds a numeric value to at most 2 digits after the decimal point.
public static function round2( value: Number ):String
Search for a string of one or multiple characters, replace with another string of one or multiple chars.
public static function replaceAll( str: String, sFind: String, sReplace: String ):String
Shrink all sequences of a given character in a string to one.
public static function shrinkSequencesOf( str: String, ch: String ):String
Tests whether the string begins with the initial string.
public static function beginsWith( str: String, initial: String ):Boolean
Returns a substring matching the part of string until the end token.
public static function substrUntil( str: String, endToken: String ):String
Trim whitespace from a string
public static function trim( str: String ):String
Trim whitespace from left hand side of a string
public static function ltrim( str: String ):String
Trim whitespace from right hand side of a string
public static function rtrim( str: String ):String