<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/fn.tokenize.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>fn.tokenize</api:function-name><api:suggest>fn.tokenize</api:suggest><api:suggest>fn</api:suggest><api:suggest>tokenize</api:suggest><api:function-link mode="xquery" fullname="fn:tokenize">/apidoc/8.0/fn:tokenize.xml</api:function-link><api:function mode="javascript" name="tokenize" type="builtin" lib="fn" category="StringBuiltins" bucket="W3C-Standard Functions" hidden="false" prefix="fn" namespace="http://www.w3.org/2005/xpath-functions" fullname="fn.tokenize"><api:summary>
  Returns a sequence of strings contructed by breaking the specified
  input into substrings separated by the specified $pattern.  The
  specified $pattern is not returned as part of the returned items.
</api:summary><api:params><api:param name="input" type="xs:string?"><api:param-description>
  The string to tokenize.
  </api:param-description><api:param-name>input</api:param-name><api:param-type>String?</api:param-type></api:param><api:param name="pattern" type="xs:string"><api:param-description>
  The regular expression pattern from which to separate the tokens.
  </api:param-description><api:param-name>pattern</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="flags" type="xs:string" optional="true"><api:param-description>
  The flag representing how to interpret the regular expression. One of
  "s", "m", "i", or "x", as defined in
  <a href="http://www.w3.org/TR/xpath-functions/#flags" xmlns="http://www.w3.org/1999/xhtml">http://www.w3.org/TR/xpath-functions/#flags</a>.
  </api:param-description><api:param-name>flags</api:param-name><api:param-type>String</api:param-type></api:param></api:params><api:return>ValueIterator</api:return><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn.tokenize("this is a string", " ");

=&gt; returns the ValueIterator containg:
   ("this", "is", "a", "string")

var arr = fn.tokenize("this is a string", " ").toArray();
arr[arr.length-1]

=&gt; string
</pre>
</api:example></api:function></api:function-page>