Namespace idx.string
Provides Javascript utility methods in addition to those provided by Dojo.
Defined in: <idx\string.js>.
Constructor Summary
Constructor Attributes | Constructor Name and Description |
---|---|
Method Summary
Method Attributes | Method Name and Description |
---|---|
<static> |
idx.string.endsWith(text, suffix)
Checks if the specified text ends with the specified suffix.
|
<static> |
idx.string.equalsIgnoreCase(s1, s2)
Case insensitive check for string equality.
|
<static> |
idx.string.escapedChars(text, The, escaper)
Escapes the specified characters in the specified text using the
specified escape character.
|
<static> |
idx.string.escapedJoin(arr, separator, escaper)
Joins the array into a single string separated by the specified
separator and using the specified escaper to escape the separator.
|
<static> |
idx.string.isNumber(n)
Checks if the specified parameter is a number and is finite.
|
<static> |
idx.string.nullTrim(str)
Trims the specified string, and if it is empty after trimming, returns null.
|
<static> |
idx.string.parseTokens(text, separators, escaper, specialChars)
Similar to iString.unescapedSplit, this function will split the
the specified text on unescaped separator characters, but will
also remove any escaping in the original text when creating the
tokens unless those escaped characters are included in the optional
"specialChars" parameter (in which case they remain escaped if
they are escaped in the original).
|
<static> |
idx.string.propToLabel(propName)
Converts a property name that is typically separated by camel case into a
psuedo label (i.e.
|
<static> |
idx.string.startsWith(text, prefix)
Checks if the specified text starts with the specified prefix.
|
<static> |
idx.string.unescapedIndexOf(text, chars, escaper, limit)
Searches the specified text for the first unescaped index of
a character contained in the specified string of characters.
|
<static> |
idx.string.unescapedSplit(text, separators, escaper, limit)
Similar to iString.parseTokens, this function will split the
the specified text on unescaped separator characters, but will
NOT remove any escaping in the original text so that the elements
in the returned array will still contain any original escaping.
|
Method Detail
<static> {Boolean} idx.string.endsWith(text, suffix)
Checks if the specified text ends with the specified suffix.
- Returns:
- {Boolean} Return true if string "text" ends with "suffix"
<static> {Boolean} idx.string.equalsIgnoreCase(s1, s2)
Case insensitive check for string equality.
- Returns:
- {Boolean} Return true if string "s1" equals to "s2" with ignoring case
<static> {String[]} idx.string.escapedChars(text, The, escaper)
Escapes the specified characters in the specified text using the
specified escape character. The escape character is also escaped
using itself.
- Parameters:
- {String} text
- The text to be escaped.
- {String} The
- string containing the characters to be escaped.
- {String} escaper
- The optional character to use for escaping (defaults to "\\").
- Returns:
- {String[]} Return the escaped text.
<static> {String[]} idx.string.escapedJoin(arr, separator, escaper)
Joins the array into a single string separated by the specified
separator and using the specified escaper to escape the separator.
- Parameters:
- {String[]} arr
- The array of objects to join as a string.
- {String} separator
- The single-character string containing the separator character.
- {String} escaper
- The optional single character to use for escaping (defaults to "\\")
- Returns:
- {String[]} Return an array of string parts.
<static> {Boolean} idx.string.isNumber(n)
Checks if the specified parameter is a number and is finite.
- Parameters:
- {Number} n
- The value to check.
- Returns:
- {Boolean} Return true if 'n' is a Number
<static> {String} idx.string.nullTrim(str)
Trims the specified string, and if it is empty after trimming, returns null.
If the specified parameter is null or undefined, then null is returned.
- Parameters:
- {String} str
- the string to trim
- Returns:
- {String} Trimmed string or null if nothing left
<static> {String[]} idx.string.parseTokens(text, separators, escaper, specialChars)
Similar to iString.unescapedSplit, this function will split the
the specified text on unescaped separator characters, but will
also remove any escaping in the original text when creating the
tokens unless those escaped characters are included in the optional
"specialChars" parameter (in which case they remain escaped if
they are escaped in the original).
- Parameters:
- {String} text
- The text to split.
- {String} separators
- The optional string containing the separator characters (defaults to ",")
- {String} escaper
- The optional character to use for escaping (defaults to "\\").
- {String} specialChars
- The optional string of special characters that if escaped in the original text should remain escaped in the tokens.
- Returns:
- {String[]} Return an array of string parts.
<static> {String} idx.string.propToLabel(propName)
Converts a property name that is typically separated by camel case into a
psuedo label (i.e.: one that is not translated but based off the property
name but formatted nicer). This method converts dots/periods into slashes.
- Parameters:
- {String} propName
- The property name to convert.
- Returns:
- {String} The converted psuedo-label.
<static> {Boolean} idx.string.startsWith(text, prefix)
Checks if the specified text starts with the specified prefix.
- Returns:
- {Boolean} Return true if string "text" starts with "prefix"
<static> {Number[]} idx.string.unescapedIndexOf(text, chars, escaper, limit)
Searches the specified text for the first unescaped index of
a character contained in the specified string of characters.
- Parameters:
- {String} text
- The text to search.
- {String} chars
- The characters for which to search (any of these).
- {String} escaper
- The optional character to use for escaping (defaults to "\\").
- {Number} limit
- The optional limit to the number of indexes desired in case only the first or first few are needed (use null, undefined, zero, false, or a negative number to indicate no limit).
- Returns:
- {Number[]} The array of indexes at which one of the specified characters is found or an empty array if not found.
<static> {String[]} idx.string.unescapedSplit(text, separators, escaper, limit)
Similar to iString.parseTokens, this function will split the
the specified text on unescaped separator characters, but will
NOT remove any escaping in the original text so that the elements
in the returned array will still contain any original escaping.
- Parameters:
- {String} text
- The text to split.
- {String} separators
- The optional string containing the separator characters (defaults to ",")
- {String} escaper
- The optional character to use for escaping (defaults to "\\").
- {Number} limit
- The optional limit to the number of tokens desired in case only the first or first few are needed (use null, undefined, zero, false, or a negative number to indicate no limit).
- Returns:
- {String[]} Return an array of string parts.