Difference between revisions of "Sindex"

From SDU
Jump to: navigation, search
m
m
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
== Description ==
+
<div align='center'><font color="green">To make corrections or additions to this article, select the ''edit'' tab above.<br>
 +
To discuss or ask questions about this article, select the ''discussion'' tab above.</font></div>
 +
 
 +
== Overview ==
 
A spel function which, although much diffrent in syntax, works similar to regex (Regular Expression) string matches found in most other programming languages.
 
A spel function which, although much diffrent in syntax, works similar to regex (Regular Expression) string matches found in most other programming languages.
  
Line 23: Line 26:
 
       set_return_data("Match!");
 
       set_return_data("Match!");
 
  }
 
  }
 
 
 
 
 
 
----
 
<div align='center'><font color="green">To make corrections or additions to this article, select the ''edit'' tab above.<br>
 
To discuss or ask questions about this article, select the ''discussion'' tab above.</font></div>
 

Revision as of 06:42, 26 July 2008

To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

A spel function which, although much diffrent in syntax, works similar to regex (Regular Expression) string matches found in most other programming languages.

Usage

sindex("string","match");

Unknown if any wildcards are supported

Results

Sindex will return a -1 is no match is found or a 0 if a match is made.

Examples

  • If statement using sindex (matching a string against a string)
if (sindex("test string", "test")==0) {return;}
  • Pushing the results of sindex into a variable (matching a string in another variable)
int results;
results=sindex(group.id, "776B094702EABB4B87F04A139E72D44B");
if (results==-1) {
      set_return_data("No Match");
} else {
      set_return_data("Match!");
}