<doc>
  <legacy_id>1143</legacy_id>
  <name>offset</name>
  <type>function</type>
  <syntax>
    <example>offset(<i>charsToFind</i>,<i>stringToSearch</i>[,<i>charsToSkip</i>])</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Text and Data Processing</category>
  </classification>
  <references>
    <command tag="sort container">sort container Command</command>
    <command tag="find">find Command</command>
    <function tag="length">length Function</function>
    <function tag="wordOffset">wordOffset Function</function>
    <function tag="itemOffset">itemOffset Function</function>
    <function tag="lineOffset">lineOffset Function</function>
    <operator tag="begins with">begins with Operator</operator>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
  </security>
  <summary><glossary tag="return">Returns</glossary> the number of <keyword tag="characters">characters</keyword> between the first <keyword tag="character">character</keyword> of a <function tag="value">value</function> and an occurrence of a specified <keyword tag="string">string</keyword>.</summary>
  <examples>
    <example>offset("c","abcde") <code><i>-- returns 3</i></code></example>
    <example>offset("b","abacadabra",2) <code><i>-- returns 6</i></code></example>
    <example>offset("bark","embarking") <code><i>-- returns 3</i></code></example>
  </examples>
  <description>
    <p>Use the <b>offset</b> <control_st tag="function">function</control_st> to find where a <keyword tag="string">string</keyword> occurs in another <keyword tag="string">string</keyword>.</p><p/><p><b>Parameters:</b></p><p>The <i>charsToFind</i> is a <keyword tag="string">string</keyword> or an <glossary tag="expression">expression</glossary> that <glossary tag="evaluate">evaluates</glossary> to a <keyword tag="string">string</keyword>.</p><p/><p>The <i>stringToSearch</i> is a <keyword tag="string">string</keyword> or an <glossary tag="expression">expression</glossary> that <glossary tag="evaluate">evaluates</glossary> to a <keyword tag="string">string</keyword>.</p><p/><p>The <i>charsToSkip</i> is a <href tag="../glossary/nondashnegative.xml">non-negative</href> <keyword tag="integer">integer</keyword>. If you don't specify how many <i>charsToSkip</i>, the <b>offset</b> <control_st tag="function">function</control_st> does not skip any <keyword tag="items">items</keyword> and starts at the beginning of the <i>stringToSearch</i>.</p><p/><p><b>Value:</b></p><p>The <b>offset</b> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> a <href tag="../glossary/nondashnegative.xml">non-negative</href> <keyword tag="integer">integer</keyword>.</p><p/><p><b>Comments:</b></p><p>The value returned by the <b>offset</b> <control_st tag="function">function</control_st> is the number of the <keyword tag="character">character</keyword> where <i>charsToFind</i> appears in <i>stringToSearch</i>. If the <i>charsToFind</i> is not in <i>stringToSearch</i>, the <b>offset</b> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> zero.</p><p/><p>If the <i>charsToFind</i> contains more than one <keyword tag="character">character</keyword>, and the entire <i>charsToFind</i> appears in the <i>stringToSearch</i>, the <b>offset</b> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> the <keyword tag="character">character</keyword> number where the <i>charsToFind</i> starts.</p><p/><p>If you specify how many <i>charsToSkip</i>, the <b>offset</b> <control_st tag="function">function</control_st> skips the specified number of <keyword tag="characters">characters</keyword> in the <i>stringToSearch</i>. The <function tag="value">value</function> <glossary tag="return">returned</glossary> is relative to this starting <keyword tag="point">point</keyword> instead of the beginning of the <i>stringToSearch</i>.</p>
  </description>
</doc>