ezeio2:scriptref:strfind

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ezeio2:scriptref:strfind [2019-06-15 18:52] – created andrehezeio2:scriptref:strfind [2019-09-02 21:43] (current) andreh
Line 1: Line 1:
-===== Script reference ====== +==== strfind ====
- +
-==== strfind( string[], sub[], ignorecase=false, index=0 ) ====+
  
 Searches a string for a substring Searches a string for a substring
Line 22: Line 20:
 Returns the offset of ''sub'' in ''string'' if successful.\\ Returns the offset of ''sub'' in ''string'' if successful.\\
 Returns -1 if no occurrence of ''sub'' was found in ''string''. Returns -1 if no occurrence of ''sub'' was found in ''string''.
 +
 +The returned offset is always relative to the start of the ''string'', even if a search offset is given.
  
 === Example usage === === Example usage ===
  
 <code javascript>     <code javascript>    
 +    new x;
     new s{20} = "CatDogAnt";     new s{20} = "CatDogAnt";
          
-    strdel(s, 3, 6);  // returns 1+    x = strfind(s, "Dog");
  
-    // is now "CatAnt"+    // is now 3
 </code> </code>
  
  • ezeio2/scriptref/strfind.1560624743.txt.gz
  • Last modified: 2019-06-15 18:52
  • by andreh