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

UChar32 UnicodeString::char32At ( int32_t  offset  )  const [inline]

Return the code point that contains the code unit at offset offset. If the offset is not valid (0..length()-1) then U+ffff is returned.

Parameters:
offset a valid offset into the text that indicates the text offset of any of the code units that will be assembled into a code point (21-bit value) and returned
Returns:
the code point of text at offset or 0xffff if the offset is not valid for this string ICU 2.0

Reimplemented from Replaceable.

Definition at line 4133 of file unistr.h.

References length(), and U16_GET.

Referenced by UnicodeSet::_appendToPat(), RuleCharacterIterator::_current(), UnicodeSet::addAll(), StringMatcher::addMatchSetTo(), StringReplacer::addReplacementSetTo(), TransliterationRule::addSourceSetTo(), DecimalFormat::appendAffixPattern(), DecimalFormat::compareComplexAffix(), SimpleDateFormat::compareSimpleAffix(), DecimalFormat::compareSimpleAffix(), Normalizer::current(), DecimalFormat::expandAffix(), TestReplaceable::getChar32At(), getChar32At(), TransliterationRule::getIndexValue(), UnicodeSet::getSingleCP(), BreakTransliterator::handleTransliterate(), RuleHalf::isValidInput(), RuleHalf::isValidOutput(), DecimalFormat::match(), StringMatcher::matchesIndexValue(), UnicodeSet::matchesIndexValue(), Normalizer::next(), CanonicalIterator::permute(), Normalizer::previous(), StringReplacer::replace(), StringReplacer::setData(), StringMatcher::setData(), DecimalFormat::setPadCharacter(), CanonicalIterator::setSource(), DecimalFormat::skipPadding(), SimpleDateFormat::skipRuleWhiteSpace(), DecimalFormat::skipRuleWhiteSpace(), SimpleDateFormat::skipUWhiteSpace(), DecimalFormat::skipUWhiteSpace(), DecimalFormat::subformat(), SimpleDateFormat::subParse(), DecimalFormat::subparse(), CharIterTest::TestIterationUChar32(), UnicodeStringTest::TestReverse(), UnicodeStringTest::TestStackAllocation(), and DecimalFormat::toPattern().

{
  int32_t len = length();
  if((uint32_t)offset < (uint32_t)len) {
    const UChar *array = getArrayStart();
    UChar32 c;
    U16_GET(array, 0, offset, len, c);
    return c;
  } else {
    return kInvalidUChar;
  }
}


Generated by  Doxygen 1.6.0   Back to index