Packageverlocity.utils
Classpublic final class StringUtil
InheritanceStringUtil Inheritance Object



Public Methods
 MethodDefined By
  
afterFirst(p_string:String, p_char:String):String
[static] Returns everything after the first occurrence of the provided character in the string.
StringUtil
  
afterLast(p_string:String, p_char:String):String
[static] Returns everything after the last occurence of the provided character in p_string.
StringUtil
  
beforeFirst(p_string:String, p_char:String):String
[static] Returns everything before the first occurrence of the provided character in the string.
StringUtil
  
beforeLast(p_string:String, p_char:String):String
[static] Returns everything before the last occurrence of the provided character in the string.
StringUtil
  
beginsWith(p_string:String, p_begin:String):Boolean
[static] Determines whether the specified string begins with the specified prefix.
StringUtil
  
between(p_string:String, p_start:String, p_end:String):String
[static] Returns everything after the first occurance of p_start and before the first occurrence of p_end in p_string.
StringUtil
  
block(p_string:String, p_len:uint, p_delim:String = .):Array
[static] Description, Utility method that intelligently breaks up your string, allowing you to create blocks of readable text.
StringUtil
  
BytesToString(bytes:int):String
[static] Returns a formatted string based on bytes given (1024 will return 1MB).
StringUtil
  
capitalize(p_string:String, ... args):String
[static] Capitallizes the first word in a string or all words..
StringUtil
  
contains(p_string:String, p_char:String):Boolean
[static] Determines whether the specified string contains any instances of p_char.
StringUtil
  
countOf(p_string:String, p_char:String, p_caseSensitive:Boolean = true):uint
[static] Determines the number of times a charactor or sub-string appears within the string.
StringUtil
  
editDistance(p_source:String, p_target:String):uint
[static] Levenshtein distance (editDistance) is a measure of the similarity between two strings, The distance is the number of deletions, insertions, or substitutions required to transform p_source into p_target.
StringUtil
  
endsWith(p_string:String, p_end:String):Boolean
[static] Determines whether the specified string ends with the specified suffix.
StringUtil
  
FormattedNumber(iNumber:int):String
[static] Returns a formatted number.
StringUtil
  
FormattedTime(iSeconds:int):String
[static] Returns a formatted time string (0.00) based on seconds given.
StringUtil
  
hasText(p_string:String):Boolean
[static] Determines whether the specified string contains text.
StringUtil
  
isEmpty(p_string:String):Boolean
[static] Determines whether the specified string contains any characters.
StringUtil
  
isNumeric(p_string:String):Boolean
[static] Determines whether the specified string is numeric.
StringUtil
  
padLeft(p_string:String, p_padChar:String, p_length:uint):String
[static] Pads p_string with specified character to a specified length from the left.
StringUtil
  
padRight(p_string:String, p_padChar:String, p_length:uint):String
[static] Pads p_string with specified character to a specified length from the right.
StringUtil
  
properCase(p_string:String):String
[static] Properly cases' the string in "sentence format".
StringUtil
  
quote(p_string:String):String
[static] Escapes all of the characters in a string to create a friendly "quotable" sting
StringUtil
  
remove(p_string:String, p_remove:String, p_caseSensitive:Boolean = true):String
[static] Removes all instances of the remove string in the input string.
StringUtil
  
removeExtraWhitespace(p_string:String):String
[static] Removes extraneous whitespace (extra spaces, tabs, line breaks, etc) from the specified string.
StringUtil
  
reverse(p_string:String):String
[static] Returns the specified string in reverse character order.
StringUtil
  
reverseWords(p_string:String):String
[static] Returns the specified string in reverse word order.
StringUtil
  
similarity(p_source:String, p_target:String):Number
[static] Determines the percentage of similiarity, based on editDistance
StringUtil
  
stripTags(p_string:String):String
[static] Remove's all symbol based tags from a string
StringUtil
  
swapCase(p_string:String):String
[static] Swaps the casing of a string.
StringUtil
  
trim(p_string:String):String
[static] Removes whitespace from the front and the end of the specified string.
StringUtil
  
trimLeft(p_string:String):String
[static] Removes whitespace from the front (left-side) of the specified string.
StringUtil
  
trimRight(p_string:String):String
[static] Removes whitespace from the end (right-side) of the specified string.
StringUtil
  
truncate(p_string:String, p_len:uint, p_suffix:String = ...):String
[static] Returns a string truncated to a specified length with optional suffix
StringUtil
  
wordCount(p_string:String):uint
[static] Determins the number of words in a string.
StringUtil
Method Detail
afterFirst()method
public static function afterFirst(p_string:String, p_char:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Returns everything after the first occurrence of the provided character in the string.

Parameters

p_string:String — The string.
 
p_char:String — The character or sub-string.

Returns
String
afterLast()method 
public static function afterLast(p_string:String, p_char:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Returns everything after the last occurence of the provided character in p_string.

Parameters

p_string:String — The string.
 
p_char:String — The character or sub-string.

Returns
String
beforeFirst()method 
public static function beforeFirst(p_string:String, p_char:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Returns everything before the first occurrence of the provided character in the string.

Parameters

p_string:String — The string.
 
p_char:String — The character or sub-string.

Returns
String
beforeLast()method 
public static function beforeLast(p_string:String, p_char:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Returns everything before the last occurrence of the provided character in the string.

Parameters

p_string:String — The string.
 
p_char:String — The character or sub-string.

Returns
String
beginsWith()method 
public static function beginsWith(p_string:String, p_begin:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Determines whether the specified string begins with the specified prefix.

Parameters

p_string:String — The string that the prefix will be checked against.
 
p_begin:String — The prefix that will be tested against the string.

Returns
Boolean
between()method 
public static function between(p_string:String, p_start:String, p_end:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Returns everything after the first occurance of p_start and before the first occurrence of p_end in p_string.

Parameters

p_string:String — The string.
 
p_start:String — The character or sub-string to use as the start index.
 
p_end:String — The character or sub-string to use as the end index.

Returns
String
block()method 
public static function block(p_string:String, p_len:uint, p_delim:String = .):Array

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Description, Utility method that intelligently breaks up your string, allowing you to create blocks of readable text. This method returns you the closest possible match to the p_delim paramater, while keeping the text length within the p_len paramter. If a match can't be found in your specified length an '...' is added to that block, and the blocking continues untill all the text is broken apart.

Parameters

p_string:String — The string to break up.
 
p_len:uint — Maximum length of each block of text.
 
p_delim:String (default = .) — delimter to end text blocks on, default = '.'

Returns
Array
BytesToString()method 
public static function BytesToString(bytes:int):String

Returns a formatted string based on bytes given (1024 will return 1MB).

Parameters

bytes:int — The amount of bytes

Returns
String
capitalize()method 
public static function capitalize(p_string:String, ... args):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Capitallizes the first word in a string or all words..

Parameters

p_string:String — The string.
 
... args — (optional) Boolean value indicating if we should capitalize all words or only the first.

Returns
String
contains()method 
public static function contains(p_string:String, p_char:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Determines whether the specified string contains any instances of p_char.

Parameters

p_string:String — The string.
 
p_char:String — The character or sub-string we are looking for.

Returns
Boolean
countOf()method 
public static function countOf(p_string:String, p_char:String, p_caseSensitive:Boolean = true):uint

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Determines the number of times a charactor or sub-string appears within the string.

Parameters

p_string:String — The string.
 
p_char:String — The character or sub-string to count.
 
p_caseSensitive:Boolean (default = true) — (optional, default is true) A boolean flag to indicate if the search is case sensitive.

Returns
uint
editDistance()method 
public static function editDistance(p_source:String, p_target:String):uint

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Levenshtein distance (editDistance) is a measure of the similarity between two strings, The distance is the number of deletions, insertions, or substitutions required to transform p_source into p_target.

Parameters

p_source:String — The source string.
 
p_target:String — The target string.

Returns
uint
endsWith()method 
public static function endsWith(p_string:String, p_end:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Determines whether the specified string ends with the specified suffix.

Parameters

p_string:String — The string that the suffic will be checked against.
 
p_end:String — The suffix that will be tested against the string.

Returns
Boolean
FormattedNumber()method 
public static function FormattedNumber(iNumber:int):String

Returns a formatted number. Example: 3000 becomes 3,000

Parameters

iNumber:int — The number to format

Returns
String
FormattedTime()method 
public static function FormattedTime(iSeconds:int):String

Returns a formatted time string (0.00) based on seconds given.

Parameters

iSeconds:int — The seconds

Returns
String
hasText()method 
public static function hasText(p_string:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Determines whether the specified string contains text.

Parameters

p_string:String — The string to check.

Returns
Boolean
isEmpty()method 
public static function isEmpty(p_string:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Determines whether the specified string contains any characters.

Parameters

p_string:String — The string to check

Returns
Boolean
isNumeric()method 
public static function isNumeric(p_string:String):Boolean

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Determines whether the specified string is numeric.

Parameters

p_string:String — The string.

Returns
Boolean
padLeft()method 
public static function padLeft(p_string:String, p_padChar:String, p_length:uint):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Pads p_string with specified character to a specified length from the left.

Parameters

p_string:String — String to pad
 
p_padChar:String — Character for pad.
 
p_length:uint — Length to pad to.

Returns
String
padRight()method 
public static function padRight(p_string:String, p_padChar:String, p_length:uint):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Pads p_string with specified character to a specified length from the right.

Parameters

p_string:String — String to pad
 
p_padChar:String — Character for pad.
 
p_length:uint — Length to pad to.

Returns
String
properCase()method 
public static function properCase(p_string:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Properly cases' the string in "sentence format".

Parameters

p_string:String — The string to check

Returns
String
quote()method 
public static function quote(p_string:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Escapes all of the characters in a string to create a friendly "quotable" sting

Parameters

p_string:String — The string that will be checked for instances of remove string

Returns
String
remove()method 
public static function remove(p_string:String, p_remove:String, p_caseSensitive:Boolean = true):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Removes all instances of the remove string in the input string.

Parameters

p_string:String — The string that will be checked for instances of remove string
 
p_remove:String — The string that will be removed from the input string.
 
p_caseSensitive:Boolean (default = true) — An optional boolean indicating if the replace is case sensitive. Default is true.

Returns
String
removeExtraWhitespace()method 
public static function removeExtraWhitespace(p_string:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Removes extraneous whitespace (extra spaces, tabs, line breaks, etc) from the specified string.

Parameters

p_string:String — The String whose extraneous whitespace will be removed.

Returns
String
reverse()method 
public static function reverse(p_string:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Returns the specified string in reverse character order.

Parameters

p_string:String — The String that will be reversed.

Returns
String
reverseWords()method 
public static function reverseWords(p_string:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Returns the specified string in reverse word order.

Parameters

p_string:String — The String that will be reversed.

Returns
String
similarity()method 
public static function similarity(p_source:String, p_target:String):Number

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Determines the percentage of similiarity, based on editDistance

Parameters

p_source:String — The source string.
 
p_target:String — The target string.

Returns
Number
stripTags()method 
public static function stripTags(p_string:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Remove's all symbol based tags from a string

Parameters

p_string:String — The source string.

Returns
String
swapCase()method 
public static function swapCase(p_string:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Swaps the casing of a string.

Parameters

p_string:String — The source string.

Returns
String
trim()method 
public static function trim(p_string:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Removes whitespace from the front and the end of the specified string.

Parameters

p_string:String — The String whose beginning and ending whitespace will will be removed.

Returns
String
trimLeft()method 
public static function trimLeft(p_string:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Removes whitespace from the front (left-side) of the specified string.

Parameters

p_string:String — The String whose beginning whitespace will be removed.

Returns
String
trimRight()method 
public static function trimRight(p_string:String):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Removes whitespace from the end (right-side) of the specified string.

Parameters

p_string:String — The String whose ending whitespace will be removed.

Returns
String
truncate()method 
public static function truncate(p_string:String, p_len:uint, p_suffix:String = ...):String

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Returns a string truncated to a specified length with optional suffix

Parameters

p_string:String — The string.
 
p_len:uint — The length the string should be shortend to
 
p_suffix:String (default = ...) — (optional, default=...) The string to append to the end of the truncated string.

Returns
String
wordCount()method 
public static function wordCount(p_string:String):uint

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

Determins the number of words in a string.

Parameters

p_string:String — The string.

Returns
uint