Functions for working with strings.
Signature: _.camelCase(string:String)
Converts a dash-separated string to camel case. Opposite of toDash.
_.camelCase("ancient-greece");
// => "ancientGreece"Signature: _.explode(s:String)
Explodes a string into an array of characters. Opposite of implode.
_.explode("Plato");
// => ["P", "l", "a", "t", "o"]Signature: _.fromQuery(str:String)
Takes a URL query string and converts it into an equivalent JavaScript object. Opposite of toQuery
_.fromQuery("forms%5Bperfect%5D=circle&forms%5Bimperfect%5D=square");
// => { forms: { perfect: "circle", imperfect: "square" } }Signature: _.implode(a:Array)
Implodes an array of strings into a single string. Opposite of explode.
_.implode(["H", "o", "m", "e", "r"]);
// => "Homer"Signature: _.isTrueish(value:String)
Checks whether an optional string parses to true with JSON. Lowercases variable before checking to ensure strings like "True" evaluate properly.
_.isTrueish();
// => false
_.isTrueish(true);
// => true
_.isTrueish('true');
// => true
_.isTrueish('FaLsE');
// => falseSignature: _.strContains(str:String, search:String)
Reports whether a string contains a search string.
_.strContains("Acropolis", "polis");
// => trueSignature: _.toDash(string:String)
Converts a camel case string to a dashed string. Opposite of camelCase.
_.toDash("thisIsSparta");
// => "this-is-sparta"Signature: _.toQuery(obj:Object)
Takes an object and converts it into an equivalent URL query string. Opposite of fromQuery.
_.toQuery({ forms: { perfect: "circle", imperfect: "square" } });
// => "forms%5Bperfect%5D=circle&forms%5Bimperfect%5D=square"