Looks for the first occurrence of the substring matching the specified string.
IppStatus ippsFind_8u(const Ipp8u* pSrc, int len, const Ipp8u* pFind, int lenFind, int* pIndex);IppStatus ippsFind_Z_8u(const Ipp8u* pSrcZ, const Ipp8u* pFindZ, int* pIndex);
IppStatus ippsFind_16u(const Ipp16u* pSrc, int len, const Ipp16u* pFind, int lenFind, int* pIndex);IppStatus ippsFind_Z_16u(const Ipp16u* pSrc, const Ipp16u* pFind, int* pIndex);
IppStatus ippsFindRev_8u(const Ipp8u* pSrc, int len, const Ipp8u* pFind, int lenFind, int* pIndex);
IppStatus ippsFindRev_16u(const Ipp16u* pSrc, int len, const Ipp16u* pFind, int lenFind, int* pIndex);
pSrc |
Pointer to the source string. |
pSrcZ |
Pointer to the zero-ended source string. |
len |
Number of elements in the source string. |
pFind |
Pointer to the reference string. |
pFindZ |
Pointer to the zero-ended reference string. |
lenFind |
Number of elements in the reference string. |
pIndex |
Pointer to the result index. |
The functions ippsFind and ippsFindRev are declared in the ippch.h file. These functions search through the source string pSrc for a substring of elements that match the specified reference string pFind. Starting point of the first occurrence of the matching substring is stored in pIndex. If no matching substring is found, then pIndex is set to -1.
The function flavor ippsFind_Z operates with the zero-ended source and reference strings. The function ippsFindRev searches the source string in the reverse direction. The search is case-sensitive.
Code example below shows how to use the function ippsFind_8u.
ippStsNoErr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error condition if at least one of the specified pointers is NULL. |
ippStsLengthErr |
Indicates an error condition if len or lenFind is negative. |
Ipp8u string[] = "abracadabra";
*/ -----------
0123456789a
*/
Ipp8u substring[] = "abra";
Ipp8u any_of [] = "ftr";
int index;
ippsFind_8u( string, sizeof (string) - 1, substring, sizeof (substring) - 1, &index );
printf ( "ippsFind_8u returned index = %d.\n", index );
ippsFindC_Z_8u( string, " c ", &index );
printf ( "ippsFind_Z_8u returned index = %d.\n", index );
ippsFindRevCAny_8u( string, sizeof (string) - 1, any_of , sizeof ( any_of ) - 1, &index );
printf ( "ippsFindRevCAny_8u returned index = %d.\n", index );
Output:
ippsFind_8u returned index = 0.
ippsFind_Z_8u returned index = 4.
ippsFindRevCAny_8u returned index = 9.
Copyright © 2000 - 2010, Intel Corporation. All rights reserved.