Skip to content
Jason Mulligan edited this page May 6, 2012 · 1 revision

string

String methods

"some random string".isEmpty(); // false

capitalize

Capitalizes the String

Example

"hi there!".capitalize(); // "Hi there!"

explode

Splits a string on comma, or a parameter, and trims each value in the resulting Array

@param {String} arg Character to split on
@returns {Array} Array of the String

Prototype

String.prototype.explode

Example

var queries = ".class, #id, type".explode(); // [".class", "#id", "type"]

toCamelCase

Transforms the case of a String into CamelCase

Prototype

String.prototype.toCamelCase

Example

" This is camel case ".toCamelCase(); // "thisIsCamelCase"

trim

Trims the leading & trailing whitespace from a String

Prototype

String.prototype.trim

Example

"    whitespace?   ".trim(); // "whitespace?"