forked from avoidwork/abaaso
-
Notifications
You must be signed in to change notification settings - Fork 0
string
Jason Mulligan edited this page May 6, 2012
·
1 revision
String methods
"some random string".isEmpty(); // false
Capitalizes the String
Example
"hi there!".capitalize(); // "Hi there!"
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"]
Transforms the case of a String into CamelCase
Prototype
String.prototype.toCamelCase
Example
" This is camel case ".toCamelCase(); // "thisIsCamelCase"
Trims the leading & trailing whitespace from a String
Prototype
String.prototype.trim
Example
" whitespace? ".trim(); // "whitespace?"