StringHelpers
StringHelpers Class Methods:
trim(str, options={})
Trims leading and trailing spaces. Also optionally trims internal excess spaces
elipsize(str, maxLength)
Adds elipsis to string, if neccessary, for maximum string length not to exceed maxLength
isEmpty(str)
Returns true if the string is all whitespace characters
startsWith(str, otherStrings)
Returns true if string starts with any of otherStrings. otherStrings = one or array to compare to
endsWith(str, otherStrings)
Returns true if string ends with any of otherStrings. otherStrings = one or array to compare to
has(str, otherStrings)
Returns true if string contains any of otherStrings. otherStrings = one or array to compare to
weakValue(str, options={})
Returns the weak value of the string -- all lowercase, plus trimmed and with excess inner whitespace ignored, locale ignored by default.
The weakly... functions below use this method on both strings being compared to return positive match of mismatched case, etc.
weaklyEqual(str, otherStrings, options={})
Returns true if the first string weakly equals any of the otherStrings. see weakValue() comments
weaklyCompare(str, otherStrings, options={})
Returns -1, 0 or 1 like javascript localeCompare. Comppares the weak values. see weakValue() comments
weaklyHas(str, otherStrings)
Returns true if the first string weakly contains any of the otherStrings. see weakValue() comments
weaklyStartsWith(str, otherStrings)
Returns true if the first string weakly starts with any of the otherStrings. see weakValue() comments
weaklyEndsWith(str, otherStrings)
Returns true if the first string weakly ends with any of the otherStrings. see weakValue() comments