Problems and Solutions>FillPoint Editor

InStr() task is case sensitive

 

Article #:

0004

Contributor:

Joanne Irvine-Smith

GF version:

3.05

Applies to:

InStr() task

Last updated:

May 25, 2001

Problem

The InStr() task returns a result of not found (0) even when the parameter being searched for does exist.

Description

The InStr() task is case sensitive. If the parameter being searched for is not the same case as the actual text in the string, the task returns a result of "0".

 

For example:

%[InStr('case','This is to test CASE sensitivity')] will return "0".

Solution

The syntax of the InStr() task is as follows:

%[InStr(SearchFor,SourceText)]

Always ensure that the "SearchFor" parameter is the same case as the text in the "SourceText" you are searching for. You can force both parameters to be the same case by adding either the UpperCase or the LowerCase task to the InStr task.

 

For example:

%[InStr('case','This is to test CASE sensitivity')] will return "0".

%[InStr(UpperCase('case'),UpperCase('This is to test CASE sensitivity'))] will return "17".

 

NOTE

See the GhostFill Scripting Language Guide for more information on tasks.