enyo.string collects a number of utility methods for working with strings.


enyo.string.applyFilterHighlight(inText, inSearchText, inClassName)

Performs a case-insensitive search for inSearchText within inText; any matches are wrapped in a <span> tag with a CSS class of inClassName, and the (potentially) modified inText string is returned.


Returns the passed-in string with <, >, and & replaced by the corresponding HTML entities (&lt;, &gt;, and &amp;).

For example, enyo.string.escapeHtml("This & That") returns This &amp; That.


Returns the passed-in string with & and " replaced by the corresponding HTML entities (&amp; and &quot;).


Returns the passed-in string with whitespace at the beginning and end removed.


Returns the passed-in string with leading and trailing quote characters removed.

For example, enyo.string.stripQuotes("foo") returns foo.


Returns a text-only version of a string that may contain HTML.

enyo.string.runTextIndexer(inText, inOptions)

Searches inText for URLs (web and mailto) and emoticons (if supported), and returns a new string with those entities replaced by HTML links and images (respectively).

inOptions is an object with fields having the following names and default values:

  phoneNumber: true,
  emailAddress: true,
  webLink: true,
  schemalessWebLink: true,
  emoticon: true

Passing false as the value for a field will prevent LunaSysMgr from HTML-izing that text type.


Encodes the string inText to Base64 and returns the encoded string.


Decodes the string inText from Base64 and returns the decoded string. Throws an exception on bad input.