StringUtil

Kind of class:class
Inherits from:none
Version:05/09/07
Author:Aaron Clinger, Mike Creighton
Classpath:org.casalib.util.StringUtil
File last modified:Monday, 01 December 2008, 13:34:40

Summary


Class methods
  • toTitleCase (source:String) : String
    • Transforms source string to per word capitalization.
  • removeNumbersFromString (source:String) : String
    • Removes all numeric characters from string.
  • getNumbersFromString (source:String) : String
    • Removes all non numeric characters from string.
  • contains (source:String, search:String) : Number
    • Determines if string contains search string.
  • trimLeft (source:String, removeChars:String) : String
    • Strips whitespace (or other characters) from the beginning of a string.
  • trimRight (source:String, removeChars:String) : String
    • Strips whitespace (or other characters) from the end of a string.
  • trim (source:String, removeChars:String) : String
    • Strips whitespace (or other characters) from the beginning and end of a string.
  • removeExtraSpaces (source:String) : String
    • Removes additional spaces from string.
  • removeWhitespace (source:String) : String
    • Removes tabs, linefeeds, carriage returns and spaces from string.
  • remove (source:String, remove:String) : String
    • Removes characters from a source string.
  • replace (source:String, remove:String, replace:String) : String
    • Replaces target characters with new characters.
  • removeAt (source:String, position:Number) : String
    • Removes a character at a specific index.
  • replaceAt (source:String, position:Number, replace:String) : String
    • Replaces a character at a specific index with new characters.
  • addAt (source:String, position:Number, addition:String) : String
    • Adds characters at a specific index.
  • getUniqueCharacters (source:String) : String
    • Extracts all the unique characters from a source String.

Class methods

addAt

static function addAt (
source:String, position:Number, addition:String) : String

Adds characters at a specific index.
Parameters:
source :
String to add characters to.
position:
Position in which to add characters.
addition:
String to add.
Returns:
  • String with characters added.

contains

static function contains (
source:String, search:String) : Number

Determines if string contains search string.
Parameters:
source:
String to search in.
search:
String to search for.
Returns:
  • Returns the frequency of the search term found in source string.

getNumbersFromString

static function getNumbersFromString (
source:String) : String

Removes all non numeric characters from string.
Parameters:
source:
String to return numbers from.
Returns:
  • String containing only numbers.

getUniqueCharacters

static function getUniqueCharacters (
source:String) : String

Extracts all the unique characters from a source String.
Parameters:
source:
String to find unique characters within.
Returns:
  • String containing unique characters from source String.

remove

static function remove (
source:String, remove:String) : String

Removes characters from a source string.
Parameters:
source:
String to remove characters from.
remove:
String describing characters to remove.
Returns:
  • String with characters removed.

removeAt

static function removeAt (
source:String, position:Number) : String

Removes a character at a specific index.
Parameters:
source :
String to remove character from.
position:
Position of character to remove.
Returns:
  • String with character removed.

removeExtraSpaces

static function removeExtraSpaces (
source:String) : String

Removes additional spaces from string.
Parameters:
source:
String to remove extra spaces from.
Returns:
  • String with additional spaces removed.

removeNumbersFromString

static function removeNumbersFromString (
source:String) : String

Removes all numeric characters from string.
Parameters:
source:
String to remove numbers from.
Returns:
  • String with numbers removed.

removeWhitespace

static function removeWhitespace (
source:String) : String

Removes tabs, linefeeds, carriage returns and spaces from string.
Parameters:
source:
String to remove whitespace from.
Returns:
  • String with whitespace removed.

replace

static function replace (
source:String, remove:String, replace:String) : String

Replaces target characters with new characters.
Parameters:
source :
String to replace characters from.
remove :
String describing characters to remove.
replace:
String to replace removed characters.
Returns:
  • String with characters replaced.

replaceAt

static function replaceAt (
source:String, position:Number, replace:String) : String

Replaces a character at a specific index with new characters.
Parameters:
source :
String to replace characters from.
position:
Position of character to replace.
replace :
String to replace removed character.
Returns:
  • String with character replaced.

toTitleCase

static function toTitleCase (
source:String) : String

Transforms source string to per word capitalization.
Parameters:
source:
String to return as title cased.
Returns:
  • String with capitalized words.

trim

static function trim (
source:String, removeChars:String) : String

Strips whitespace (or other characters) from the beginning and end of a string.
Parameters:
source :
String to remove characters from.
removeChars:
[optional] Characters to strip (case sensitive); defaults to all whitespace characters.
Returns:
  • String with characters removed.

trimLeft

static function trimLeft (
source:String, removeChars:String) : String

Strips whitespace (or other characters) from the beginning of a string.
Parameters:
source :
String to remove characters from.
removeChars:
[optional] Characters to strip (case sensitive); defaults to all whitespace characters.
Returns:
  • String with characters removed.

trimRight

static function trimRight (
source:String, removeChars:String) : String

Strips whitespace (or other characters) from the end of a string.
Parameters:
source :
String to remove characters from.
removeChars:
[optional] Characters to strip (case sensitive); defaults to all whitespace characters.
Returns:
  • String with characters removed.