User Tools

Site Tools


DzStringHelper

Convenience object to make working with a String object easier.

More...

Inherits :

Constructors

DAZ Script
DzStringHelper ()

Methods

DAZ Script
StringchangeSpecialChars ( String text, String chars )
ArraygetMatches ( String text, String expression )
ArraygetWords ( String text, Boolean removeEmpties )
StringindentString ( String text, Number level )
StringprependCharsIfNumeric ( String text, String chars )
StringreplaceAll ( String source, String findText, String replaceText )
StringstripCRLF ( String text )
StringstripSpaces ( String text )

Detailed Description

TODO: Add detailed description.

Constructors


DzStringHelper()

Default Constructor

Methods


String : changeSpecialChars( String text, String chars )

Parameter(s):

  • text - The string to inspect for special characters; using the regular expression "[/\\\\:*?\"<>|!. ]"
  • chars - The character(s) to replace each occurence of a special character with

Return Value:

  • A copy of the input string, with each occurence of a special character replaced by chars

Array : getMatches( String text, String expression )

Parameter(s):

  • text - The string to check for matches
  • expression - The regular expression to use

Return Value:

  • An array of strings, where each element is a match

Array : getWords( String text, Boolean removeEmpties )

Parameter(s):

  • text - The string to split at each space
  • removeEmpties - Whether or not to remove empty entries that result from multiple adjacent spaces

Return Value:

  • An array of strings, where each element is a word from the input string

String : indentString( String text, Number level )

Parameter(s):

  • text - The string to indent
  • level - The number of tabs (\t) to prepend to the input string

Return Value:

  • A copy of the input string indented the specified number of times

String : prependCharsIfNumeric( String text, String chars )

Parameter(s):

  • text - The string to inspect for numeric characters; using the regular expression “^[0-9]”
  • chars - The character(s) to prepend to the input string if it begines with a numeric character

Return Value:

  • A copy of the input string, with chars prepended if it began with a numeric character

String : replaceAll( String source, String findText, String replaceText )

Parameter(s):

  • source - The string to replace the specified character(s) in
  • findText - The character(s) to replace
  • replaceText - The character(s) to replace with

Return Value:

  • A copy of the input string with all occurrences of findText replaced by replaceText

String : stripCRLF( String text )

Parameter(s):

  • text - The string to strip all carriage return (\r) and linefeed (\n) characters from

Return Value:

  • A copy of the input string with all carriage return and linefeed characters removed

String : stripSpaces( String text )

Parameter(s):

  • text - The string to strip spaces from

Return Value:

  • A copy of the input string with all spaces removed