StructureJS
0.15.2A class based utility library for building modular and scalable web platform applications. Features opt-in classes and utilities which provide a solid foundation and toolset to build your next project.
The StringUtil...
createUUID
()
String
public
static
Creates a universally unique identifier.
StringUtil.createUUID();
// 'a95d7134-3342-4001-bcea-cc0371b70dec'
format
str
...rest
getExtension
filename
withDot
paramReplace
queryString
name
value
queryStringToObject
queryString
[useParseFloat=false]
Converts a query string to an object.
StringUtil.queryStringToObject('?name=Robert&age=23&gender=male');
// {name: 'Robert', age: '23', gender: 'male'}
StringUtil.queryStringToObject('?name=Robert&age=23&gender=male', true);
// {name: 'Robert', age: 23, gender: 'male'}
removeAllWhitespace
str
removeLeadingTrailingWhitespace
str
toCamelCase
str
toConstantCase
str
toPascalCase
str
toQueryString
obj
Converts a query string to an object.
obj
Object
StringUtil.toQueryString({name: 'Robert', age: '23', gender: 'male'});
// name=Robert&age=23&gender=male'
toSentence
str
[separator]
Converts a string to a sentence case string.
StringUtil.toSentence("liveDown_by-the.River");
// 'live down by the river'
StringUtil.toSentence("liveDown_by-the.River", '-');
// 'live-down-by-the-river'
StringUtil.toSentence("liveDown_by-the.River", '_');
// 'live_down_by_the_river'
StringUtil.toSentence("liveDown_by-the.River", '/');
// 'live/down/by/the/river'
truncate
text
length
indicator