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

int32_t UnicodeString::getChar32Start ( int32_t  offset  )  const [inline]

Adjust a random-access offset so that it points to the beginning of a Unicode character. The offset that is passed in points to any code unit of a code point, while the returned offset will point to the first code unit of the same code point. In UTF-16, if the input offset points to a second surrogate of a surrogate pair, then the returned offset will point to the first surrogate.

Parameters:
offset a valid offset into one code point of the text
Returns:
offset of the first code unit of the same code point
See also:
U16_SET_CP_START ICU 2.0

Definition at line 4147 of file unistr.h.

References length(), and U16_SET_CP_START.

Referenced by UnicodeStringTest::TestBasicManipulation().

                                                  {
  if((uint32_t)offset < (uint32_t)length()) {
    const UChar *array = getArrayStart();
    U16_SET_CP_START(array, 0, offset);
    return offset;
  } else {
    return 0;
  }
}


Generated by  Doxygen 1.6.0   Back to index