Please enable JavaScript to view this site.

 

bool = StrIsContained(sOne, sTwo, bCaseSensitive)

 

This macro function compares two strings, sOne and sTwo, and returns true if sOne is contained in sTwo, and false otherwise.

 

The inverse function is StrContains.

StrIsContained('A''Z', false);       // false
StrIsContained('AAA''aaaa', false);  // true
StrIsContained('AAAB''aaaa', false); // false
StrIsContained('A''a', false);       // true
StrIsContained('Aaaa''aaaa', false); // true

The Boolean parameter, bCaseSensitive, determines if the comparison is to take note of uppercase and lowercase letters.

StrIsContained('A''Z', true);       // false
StrIsContained('AAA''aaaa', true);  // false
StrIsContained('AAAB''aaaa', true); // false
StrIsContained('A''a', true);       // false
StrIsContained('Aaaa''aaaa', true); // false

Note that the functionality of this function can also be reproduced using the Pos and LowerCase functions.

if bCaseSensitive
   bIsContained = Pos(sOne,sTwo) > 0
else
   bIsContained = Pos(LowerCase(sOne),LowerCase(sTwo)) > 0
endif

See also: StrContains.

 


Topic 137100, last updated on 18-Apr-2020