|
Previous Top Next |
Prototype: | (String pNeedle, String pHaystack, Byte pCaseSensitive=False, Byte pSave=True),Long |
pNeedle | The string to search for. |
pHaystack | The string to search in. |
pCaseSensitive | Indicates if the search should be case sensitive or not. By default it is not case sensitive. |
pSave | Indicates if the resulting finds should be saved to the Found queue property. |
Returns | The 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