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

UnicodeString UnicodeString::tempSubString ( int32_t  start = 0,
int32_t  length = INT32_MAX 
) const

Create a temporary substring for the specified range. Unlike the substring constructor and setTo() functions, the object returned here will be a read-only alias (using getBuffer()) rather than copying the text. As a result, this substring operation is much faster but requires that the original string not be modified or deleted during the lifetime of the returned substring object.

start offset of the first character visible in the substring
length length of the substring
a read-only alias UnicodeString object for the substring ICU 4.4

Definition at line 784 of file unistr.cpp.

References FALSE, getBuffer(), NULL, and UnicodeString().

Referenced by tempSubStringBetween(), and unorm_compare().

  pinIndices(start, len);
  const UChar *array = getBuffer();  // not getArrayStart() to check kIsBogus & kOpenGetBuffer
  if(array==NULL) {
    array=fUnion.fStackBuffer;  // anything not NULL because that would make an empty string
    len=-2;  // bogus result string
  return UnicodeString(FALSE, array + start, len);

Generated by  Doxygen 1.6.0   Back to index