SplitC

Splits source string into separate parts.

Syntax

IppStatus ippsSplitC_8u_D2L(const Ipp8u* pSrc, int srcLen, Ipp8u delim, Ipp8u* pDst[], int* pDstLen[], int* pNumDst);

IppStatus ippsSplitC_16u_D2L(const Ipp16u* pSrc, int srcLen, Ipp16u delim, Ipp16u* pDst[], int* pDstLen[], int* pNumDst);

Parameters

pSrc

Pointer to the source strings.

srcLen

Number of elements in the source string.

delim

Symbol delimiter.

pDst

Pointer to the array of the destination strings.

pDstLen

Pointer to array of the destination string lengths.

pNumDst

Number of destination strings.

Description

The function ippsSplitC is declared in the ippch.h file. This function breaks source string pSrc into pNumDst separate strings pDst using a specified symbol delim as a delimiter. If n specified delimiters occur in the beginning or in the end of the source string, then n empty strings are appended to the array of destination strings. If n specified delimiters occur in a certain position within the source string, then (n-1) empty strings are inserted into the array of destination strings, where n is the number of delimiter occurrences in this position.

Code example below shows how to use the function ippsSplitC_8u_2DL.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error condition if one of the specified pointers is NULL.

ippStsLengthErr

Indicates an error condition if srcLen is negative, or pDstLen is negative for i < pNumDst.

ippStsSizeErr

Indicates an error condition if pNumDst is equal to or less than 0.

ippStsOvermatchStrings

Indicates a warning if number of output strings exceeds the initially specified number pNumDst; in this case odd strings are discarded.

ippStsOverlongString

Indicates a warning if in some output strings the number of elements exceeds the initially specified value pDstLen; in this case corresponding strings are truncated to initial lengths.

Using the function ippsSplitC

 Ipp8u string[] = "1st string # 2nd string";
 Ipp8u dst_string0[ sizeof (string)];
 Ipp8u dst_string1[ sizeof (string)];
 Ipp8u* dst_string_ptr [] = { dst_string0, dst_string1 };
 int dst_string_len_ptr [] = { sizeof (dst_string0), sizeof (dst_string1) };
 int dst_string_num = 2;
 int i ;
 ippsSplitC_8u_D2L( string, sizeof (string) - 1, '#', dst_string_ptr, dst_string_len_ptr, & dst_string_num );
 printf ( "Destination strings number: %d\n", dst_string_num );
 for( i = 0; i < dst_string_num ; i ++ ) {
     dst_string_ptr [ i ][ dst_string_len_ptr [ i ]] = 0;
     printf ( "%d: %s.\n", i, (char*) dst_string_ptr [ i ] );
 }
 Output:
 Destination strings number: 2
 0: 1st string.
 1: 2nd string.

Submit feedback on this help topic

Copyright © 2000 - 2010, Intel Corporation. All rights reserved.