Manual:DIL Manual/strncmp()

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 22:32, 4 December 2025 by Nove (talk | contribs) (XML import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function:  integer strcmp( s1:string, s2:string l :integer) ;
  s1
         first string
  s2
         second string
  l
         amount of significant digits to compare
 returns
  -1
         if s1 < s2
  0
         if s1 = s2
  1
         if s1 > s2


This allows you to compare strings with case sensitivity in place and it
allows you to choose how much of the strings are compared.
example:

---~---~---~---~---~---~---~---~---
if (strcmp("Mark Carper",s2,4)==0))

---~---~---~---~---~---~---~---~---



---~---~---~---~---~---~---~---~---

Function:  integer strcmp( s1:string, s2:string l :integer) ;
  s1
         first string
  s2
         second string
  l
         amount of significant digits to compare
 returns
  -1
         if s1 < s2
  0
         if s1 = s2
  1
         if s1 > s2


This allows you to compare strings with case sensitivity in place and it
allows you to choose how much of the strings are compared.
example:

---~---~---~---~---~---~---~---~---
if (strcmp("Mark Carper",s2,4)==0))

---~---~---~---~---~---~---~---~---



---~---~---~---~---~---~---~---~---