www.icetips.com  Icetips Utilities Documentation 7/6/2014    

String Class:  FindInString

Previous  Top  Next  


Prototype: (String pNeedle, String pHaystack, Byte pCaseSensitive=False, Byte pSave=True),Long

 

pNeedleThe string to search for.
pHaystackThe string to search in.
pCaseSensitiveIndicates if the search should be case sensitive or not.  By default it is not case sensitive.
pSaveIndicates if the resulting finds should be saved to the Found queue property.

 

ReturnsThe number of times the needle is found in the haystack. 

 

This is a very powerful search method, similar to the InString function in Clarion - in fact it uses the InString() function internally.  But instead of returning the start position like InString() does, it returns you the number of instances that the needle string is found in the haystack string.  It can also save the start and end position of each found string (needle) in the search string (haystack) so it is easy to split and splice the string.  The results are stored in the Found queue property.

 

Example:

ITS  ITStringClass

Code

Message('Found: ' & ITS.FindInString('test','This is a test to find "Test" in the TestString'))

!! Will show 3.  ITS.Found now has 3 records in it with the start/end position of each "test" find.

 

 

See also:

Found
 

 



Direct link to this page: http://www.icetips.com/manuals/utilities/findinstring_stringclass.htm