Difference between revisions of "Manual:DIL Manual/string in stringlist"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
(XML import)
 
Line 1: Line 1:
 +
<span id="esinsl"></span>
 +
string 'in' stringlist
 +
    Argument 1: A string to find.
 +
    Argument 2: A stringlist to search.
 +
    Returns: 1.. if first string is found in stringlist, or 0 if it is
 +
            non existent. If found the number equals the index of the
 +
            string found plus one.
  
 +
Example 1:
 +
  s := "c";
 +
  sl :=
 +
;
 +
  i := s in sl;
 +
 +
  The result of 'i' is 3, and sl.[i-1] equals "c" (s).
 +
 +
Example 2:
 +
 +
<nowiki>
 +
 +
  dilbegin foo();
 +
  code
 +
dilend</nowiki>
  
 +
---~---~---~---~---~---~---~---~---
 
<span id="esinsl"></span>
 
<span id="esinsl"></span>
 
  string 'in' stringlist
 
  string 'in' stringlist
Line 11: Line 34:
 
  Example 1:
 
  Example 1:
 
   s := "c";
 
   s := "c";
   sl := {"a","b","c","d"};
+
   sl :=
 +
;
 
   i := s in sl;
 
   i := s in sl;
  
Line 22: Line 46:
 
   dilbegin foo();
 
   dilbegin foo();
 
   code
 
   code
  {
+
dilend</nowiki>
    if ("james" in activator.names)
 
      exec("say hello james.",self);
 
    pause;
 
  }
 
  dilend</nowiki>
 
  
 
  ---~---~---~---~---~---~---~---~---
 
  ---~---~---~---~---~---~---~---~---

Latest revision as of 22:35, 4 December 2025

string 'in' stringlist
   Argument 1: A string to find.
   Argument 2: A stringlist to search.
   Returns: 1.. if first string is found in stringlist, or 0 if it is
            non existent. If found the number equals the index of the
            string found plus one.
Example 1:
  s := "c";
  sl :=
  i := s in sl;
  The result of 'i' is 3, and sl.[i-1] equals "c" (s).
Example 2:

   dilbegin foo();
   code
dilend
---~---~---~---~---~---~---~---~---

string 'in' stringlist
   Argument 1: A string to find.
   Argument 2: A stringlist to search.
   Returns: 1.. if first string is found in stringlist, or 0 if it is
            non existent. If found the number equals the index of the
            string found plus one.
Example 1:
  s := "c";
  sl :=
  i := s in sl;
  The result of 'i' is 3, and sl.[i-1] equals "c" (s).
Example 2:

   dilbegin foo();
   code
dilend
---~---~---~---~---~---~---~---~---