Wafl Home

Primitive Data Types Tutorial

Search Functions

Wafl contains the following string searching functions:

strPos :          (String * String -> Integer)
strPosI :         (String * String -> Integer)
strLastPos :      (String * String -> Integer)
strLastPosI :     (String * String -> Integer)
strNextLastPos :  (String * String * Integer -> Integer)
strNextLastPosI : (String * String * Integer -> Integer)
strNextPos :      (String * String * Integer -> Integer)
strNextPosI :     (String * String * Integer -> Integer)

All functions return the beginning position of the second specified string in the first specified string, if it is found, and -1 if it is not. Functions, which names end with 'I', ignore the letter case.

Function strPos(s,p) returns the position of the first appearance of the string p in string s. Function strNextPos(s,p,i) returns the position of the first appearance of the string p in string s after the position i.

Function strLastPos(s,p) returns the position of the last appearance of the string p in string s.

Function strNextLastPos(s,p,i) returns the position of the last appearance of the string p in string s before the position i.

Source code:

{#
strPos( 'abcabcabc', 'b' ),
strLastPos( 'abcabcabc', 'b' ),
strNextPos( 'abcabcabc', 'b', 1 ),
strNextLastPos( 'abcabcabc', 'b', 7 )
#}

Result:

{# 1, 7, 4, 4 #}

 

Table of Contents

Let's Start

Program Structure

Primitive Data Types

List

Tuple

Record

HTML

Command Line Interpreter

Using Web Servers

Syntax

Examples

Tips

The most of examples evaluates with both command line and Web server Wafl interpreters. If any example is based on specific features of an interpreter, it is explicitly annotated.