String
Methods
htmlDecode(str) → {String} static
Decodes html into it's string contents.
Parameters:
Name Type Description str String The string to decode.
Returns:
The decoded string.
parseQueryString(str) → {Object} static
Parses a url parameter string into an object.
Parameters:
Name Type Description str String The string to parse.
Returns:
The object representation of the parsed string.
sprintf(fmt) → {String} static
Returns a string produced according to the formatting string fmt.
Parameters:
Name Type Description fmt String The format string is composed of zero or more directives: ordinary characters (excluding %) that are copied directly to the result, and conversion specifications, each of which results in fetching its own parameter.
- % - a literal percent character. No argument is required.
- b - the argument is treated as an integer, and presented as a binary number.
- c - the argument is treated as an integer, and presented as the character with that ASCII value.
- d - the argument is treated as an integer, and presented as a (signed) decimal number.
- e - the argument is treated as scientific notation (e.g. 1.2e+2). The precision specifier stands for the number of digits after the decimal point since PHP 5.2.1. In earlier versions, it was taken as number of significant digits (one less).
- E - like %e but uses uppercase letter (e.g. 1.2E+2).
- f - the argument is treated as a float, and presented as a floating-point number (locale aware).
- F - the argument is treated as a float, and presented as a floating-point number (non-locale aware). Available since PHP 4.3.10 and PHP 5.0.3.
- g - shorter of %e and %f.
- G - shorter of %E and %f.
- o - the argument is treated as an integer, and presented as an octal number.
- s - the argument is treated as and presented as a string.
- u - the argument is treated as an integer, and presented as an unsigned decimal number.
- x - the argument is treated as an integer and presented as a hexadecimal number (with lowercase letters).
- X - the argument is treated as an integer and presented as a hexadecimal number (with uppercase letters).
Returns:
The formatted string.
vsprintf(fmt, str) → {String} static
Return a formatted string. Operates as String.sprintf() but accepts an array of arguments, rather than a variable number of arguments.
Parameters:
Name Type Description fmt String The string to use as format.
str Array The items to use in the format.
Returns:
The formatted string.
camelize() → {String}
Converts string to camel case.
Returns:
The string in camel case.
capitalize() → {String}
Converts the first character of string to upper case and the remaining to lower case.
Returns:
The capitalized string.
clean() → {String}
Cleans the string from whitespace characters.
Returns:
The cleaned string.
contains(value) → {Boolean}
Returns true of false based on whether value is in string or not.
Parameters:
Name Type Description value String Value to check for.
Returns:
dasherize() → {String}
Converts string to dash case.
Returns:
The dasherized string.
endsWith(searchString, position) → {Boolean}
Determines whether a string ends with the characters of a specified string, returning true or false as appropriate.
Parameters:
Name Type Argument Description searchString String The characters to be searched for at the end of this string.
position Number optional If provided starts the match from the length of the string minus the second argument. If omitted, the default value is the length of the string.
Returns:
true if the given characters are found at the end of the string; otherwise, false.
htmlEscape() → {String}
Escapes html entities (&"'<>) within the string.
Returns:
The html escaped string.
hyphenate() → {String}
Converts string to hyphen case.
Returns:
The hyphenated string.
includes(searchString, position) → {Boolean}
Determines whether one string may be found within another string, returning true or false as appropriate.
Parameters:
Name Type Argument Default Description searchString String A string to be searched for within this string.
position Number optional 0 The position within the string at which to begin searching for searchString.
Returns:
true if the given string is found anywhere within the search string; otherwise, false if not.
repeat(count, separator) → {String}
Repeats the given string n times.
Parameters:
Name Type Argument Default Description count Number Number times the string should be repeated.
separator String optional '' Optional separator between each repetition of the string.
Returns:
The repeated string.
reverse() → {String}
Reverses the string.
Returns:
The reversed string.
startsWith(searchString, position) → {Boolean}
Determines whether a string begins with the characters of a specified string, returning true or false as appropriate.
Parameters:
Name Type Argument Default Description searchString String The characters to be searched for at the start of this string.
position Number optional 0 The position in this string at which to begin searching for searchString.
Returns:
true if the given characters are found at the beginning of the string; otherwise, false.
stripTags(tag, contents) → {String}
Strips html tags from the string.
Parameters:
Name Type Argument Default Description tag String Tag to strip from the string.
contents Boolean optional false Remove the contents of the tags.
Returns:
The stripped string.
trim() → {String}
Removes leading and trailing whitespace from string.
Returns:
The trimmed string.