Logo Search packages:      
Sourcecode: icu version File versions  Download package

int32_t UnicodeString::extract ( int32_t  start,
int32_t  startLength,
char *  target,
const char *  codepage = 0 
) const [inline]

Copy the characters in the range [start, start + length) into an array of characters in a specified codepage. The output string is NUL-terminated.

Recommendation: For invariant-character strings use extract(int32_t start, int32_t length, char *target, int32_t targetCapacity, enum EInvariant inv) const because it avoids object code dependencies of UnicodeString on the conversion code.

Parameters:
start offset of first character which will be copied
startLength the number of characters to extract
target the target buffer for extraction
codepage the desired codepage for the characters. 0 has the special meaning of the default codepage If codepage is an empty string (""), then a simple conversion is performed on the codepage-invariant subset ("invariant characters") of the platform encoding. See utypes.h. If target is NULL, then the number of bytes required for target is returned. It is assumed that the target is big enough to fit all of the characters.
Returns:
the output string length, not including the terminating NUL ICU 2.0

Definition at line 4081 of file unistr.h.

References extract(), and UINT32_MAX.

{
  // This dstSize value will be checked explicitly
#if defined(__GNUC__)
  // Ticket #7039: Clip length to the maximum valid length to the end of addressable memory given the starting address
  // This is only an issue when using GCC and certain optimizations are turned on.
  return extract(start, _length, dst, dst!=0 ? ((dst >= (char*)((size_t)-1) - UINT32_MAX) ? (((char*)UINT32_MAX) - dst) : UINT32_MAX) : 0, codepage);
#else
  return extract(start, _length, dst, dst!=0 ? 0xffffffff : 0, codepage);
#endif
}


Generated by  Doxygen 1.6.0   Back to index