{"identifier":60426,"topic":"Functions","name":"offset","text":"<code><pre>offset(<i>text1<\/i>, <i>text2<\/i>)\n<\/pre><\/code>\nValue returned: the number 0 if<code> <i>text1<\/i> <\/code>does not appear in<code> <i>text2<\/i><\/code>; otherwise, a positive integer equal to the number of characters from the first character of<code> <i>text2<\/i> <\/code>to the first character of<code> <i>text1<\/i> <\/code>within<code> <i>text2<\/i><\/code> <br>\n","related":{"32809":null,"52559":"charToNum","57200":"length","60292":"numToChar","90270":"String operators"},"examples":"get offset(\"world\", \"Hello world\")\n\nput offset(searchString,card field \"Index\") into theOffset\n\nput offset(line 1 of card field 1, collectedHits) into N\nif N is 0 then ...\nelse ...","demo":"<code><pre>on answerDiskName\n  answer \"This stack resides on the disk named\" && diskName() & \".\"\nend answerDiskName\nfunction diskName thelongName\n  if thelongName is empty\n  then put the long name of this stack into theLongName\n  -- remove \u201cstack \"\u201d from the beginning of theLongName\n  delete char 1 to <b>offset<\/b>(quote,theLongName) of theLongName\n  -- return word before the first \u201c:\u201d\n  return char 1 to <b>offset<\/b>(\":\",theLongName) - 1 of theLongName\nend diskName<\/pre><\/code>\n ","debug":{"9":["offset(text1, text2)"]}}