Class: StringUtil

StringUtil()

Helper Class for Strings

Constructor

new StringUtil()

Source:

Methods

(static) coerce(string) → {*}

This coerces the value of a string by casting it to the most plausible datatype, guessed by the value itself.

Parameters:
Name Type Description
string String

The input string to coerce.

Source:
Returns:

The coerced value.

Type
*

(static) stringDivider(str, width, spaceReplacer) → {String}

Returns a string that is wrapped: every ~width chars a space is replaced with the passed spaceReplacer.

See http://stackoverflow.com/questions/14484787/wrap-text-in-javascript

Parameters:
Name Type Description
str String

The string to wrap.

width Number

The width of a line (number of characters).

spaceReplacer String

The string to replace spaces with.

Source:
Returns:

The 'wrapped' string.

Type
String

(static) stripHTMLTags(htmlString) → {string}

Returns the displayed text of an string with html text.

Parameters:
Name Type Description
htmlString string

A string containing html.

Source:
Returns:

The stripped Text.

Type
string

(static) urlify(text) → {String}

Replaces any occurence of a link-like text with tag.

Parameters:
Name Type Description
text String

The string context to replace.

Source:
Returns:

The urlified string.

Type
String