TrimC

Deletes all occurrences of a specified symbol in the beginning and in the end of the string.

Syntax

IppStatus ippsTrimC_8u(const Ipp8u* pSrc, int srcLen, Ipp8u odd, Ipp8u* pDst, int* pDstLen);

IppStatus ippsTrimC_8u_I(Ipp8u* pSrcDst, int* pLen, Ipp8u odd);

Include Files

ippch.h

Domain Dependencies

Headers: ippcore.h, ippvm.h, ipps.h

Libraries: ippcore.lib, ippvm.lib, ipps.lib

Parameters

pSrc

Pointer to the source string.

srcLen

Number of elements in the source string.

pSrcDst

Pointer to the source and destination string for the in-place operation.

pDst

Pointer to the destination string.

pDstLen

Pointer to the computed number of elements in the destination string.

pLen

Pointer to the number of elements in the source and destination string for the in-place operation.

odd

Symbol to be deleted.

Description

This function deletes all occurrences of a specified symbol odd if it is present in the beginning and in the end of the source string pSrc containing srcLen elements. The function stores the result string containing pDstLen elements in pDst.

The in-place flavors of ippsTrimC delete all occurrences of a specified symbol odd if it is present in the beginning and in the end of the source string pSrcDst containing pLen elements. These functions store the result string containing pLen elements in pSrcDst.

The operation is case-sensitive.

Return Values

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 srcLen or pLen is negative.

Example

The code example below shows how to use the function ippsTrimC_8u_I.

 Ipp8u string[] = " ### abracadabra $$$ ";
 Ipp8u trim[] = " $#* ";
 Ipp8u dst_string [ sizeof (string)];
 int string_len , dst_string_len ;
 ippsTrimCAny_8u( string, sizeof (string) - 1, trim, sizeof (string) - 1, dst_string,& dst_string_len );
 dst_string [ dst_string_len ] = 0;
 printf ( "ippsTrimCAny_8u returned: %s.\n", (char*) dst_string );
 string_len = sizeof (string) - 1;
 ippsTrimC_8u_I( string, & string_len , ' # ' );
 string[ string_len ] = 0;
 printf ( "ippsTrimC_8u_I returned: %s.\n", (char*)string );

Result:

ippsTrimCAny_8u returned: abracadabra .
 ippsTrimC_8u_I returned: abracadabra$$$ .

For more complete information about compiler optimizations, see our Optimization Notice.