Wafl Home

Primitive Data Types Tutorial

Replace Functions

Wafl contains the following string replacing functions:

strReplace :     (String * String * String * Integer -> String)
strReplaceAll :  (String * String * String -> String)
strReplaceAllI : (String * String * String -> String)
strReplaceI :    (String * String * String * Integer -> String)
strLowerCase :   (String -> String)
strUpperCase :   (String -> String)

All strReplace functions compute the first specified string, while replacing appearance(s) of the second specified string by the third specified string. Original string remains unchanged. Functions, which names end with 'I', ignore the letter case in searching the second string.

Function strReplace(s,p,x,i) returns string s with i-th appearance of sub string p replaced with string x. Function strReplaceAll(s,p,x) returns string s with all i-th appearances of sub string p replaced with string x.

Function strLowerCase(s) returns string s with all upper case characters replaced with appropriate lower case characters. Function strUpperCase(s) returns string s with all lower case characters replaced with appropriate upper case characters.

Source code:

{#
strReplace( 'abABabAB', 'a', '@', 2 ),
strReplaceI( 'abABabAB', 'a', '@', 2 ),
strReplaceAll( 'abABabAB', 'a', '@' ),
strLowerCase( 'abABabAB' ),
strUpperCase( 'abABabAB' )
#}

Result:

{# "abAB@bAB", "ab@BabAB", "@bAB@bAB", "abababab", "ABABABAB" #}

 

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.