Jaxer.Util.String : Object
Return to: Jaxer Framework index

Namespace that holds functions and other objects that extend JavaScript's string capabilities.

Platform Support

Jaxer Server Framework Jaxer Client Framework
1.0 no

Functions

Method Action Jaxer Server Framework Jaxer Client Framework
static endsWith(String inString, String lookFor, Boolean ignoreCase) : Boolean
Check to see if a string ends with a string
Show Details 1.0 no

Parameters
String inString The string to look in
String lookFor The string to look for
Boolean ignoreCase Set to true for case insensitive searches

Returns
Boolean true if the string ends with the provided string

static escapeForJS(String raw) : String
Escapes an input string for use with javascript
Show Details 1.0 no

Parameters
String raw The source string

Returns
String The escaped string suitable for use in an eval statement

static escapeForSQL(String raw) : String
Escapes an input string for use with SQL
Show Details 1.0 no

Parameters
String raw The source string

Returns
String The escaped string suitable for use in a SQL query

static grep(String stringOrArray, String pattern) : Array<String>
Searches the given lines for the given pattern, and returns the lines that matched.
Show Details 1.0 no

Parameters
String stringOrArray The string to search through, which will be split up into its lines, or an array of lines (i.e. a string that has already been split)
String pattern The string pattern to look for, which will be turned into a RegExp, or the RegExp to match

Returns
Array<String> An array of the lines that matched the pattern

static singleQuote(String text) : String
Surround the provided string in single quotation marks
Show Details 1.0 no

Parameters
String text The original string

Returns
String The original string encased in single quotes

static startsWith(String inString, String lookFor, Boolean ignoreCase) : Boolean
Check to see if a string starts with another string
Show Details 1.0 no

Parameters
String inString The string to look in
String lookFor The string to look for
Boolean ignoreCase Set to true for case insensitive searches

Returns
Boolean true if the string starts with the provided string

static trim(String str, [String charsToTrim,] [String leftOrRight]) : String
Left or right trim the provided string. Optionally, you can specify a list of characters (as a single string) to trim from the source string. By default, whitespace is removed. Also, you can control which side of the string (start or end) is trimmed with the default being both sides.
Show Details 1.0 no

Parameters
String str The source string
String charsToTrim (optional)This optional parameter can be used to specify a list of characters to remove from the sides of the source string. Any combination of these characters will be removed. If this parameter is not specified, then all whitespace characters will be removed.
String leftOrRight (optional)This optional parameter can be used to control which side of the string is trimmed. A value of "L" will trim the start of the string and all other string values will trim the end of the string. If this parameter is not specified, then both sides of the string will be trimmed

Returns
String The resulting trimmed string

static upperCaseToCamelCase(String orig) : String
Convert a string to a CamelCase representation by removing interword spaces and capitalizing the first letter of each word following an underscore
Show Details 1.0 no

Parameters
String orig The orignal string containing underscores between words

Returns
String The resulting string with underscores removed and the first letter of a word capitalized

aptana_docs