strpos command

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6364 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lucas GAUTHERON
2011-04-27 10:49:15 +00:00
parent 0de227020d
commit 4e9be4519d
2 changed files with 61 additions and 0 deletions
+37
View File
@@ -430,6 +430,43 @@
</references>
</command>
<command name="strpos">
<description>Returns the position of a substring into another</description>
<arguments>
<argument token="H" description="haystack string"/>
<argument token="S" description="needle string"/>
<argument token="N" description="The occurence of 'needle' to find (optionnal)" />
</arguments>
<return token="N" description="The N'th position of 'needle' into 'haystack' (-1 if 'needle' isn't found;)" />
<remarks>
<remark>Character indexes and occurence number begin at 0.</remark>
</remarks>
<examples>
<example>
<code>
<![CDATA[echo (strpos "hello world" "world")
6]]>
</code>
</example>
<example>
<code>
<![CDATA[echo (strpos "hello world" "l")
2]]>
</code>
</example>
<example>
<code>
<![CDATA[echo (strpos "hello world" "l" 2)
9]]>
</code>
<code>
<![CDATA[echo (strpos "hello world" "l" 3)
-1]]>
</code>
</example>
</examples>
</command>
<command name="substr">
<description>Copies a substring out of the original.</description>
<arguments>