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

UnicodeString & UnicodeString::setCharAt ( int32_t  offset,
UChar  ch 
)

Set the character at the specified offset to the specified character.

Parameters:
offset A valid offset into the text of the character to set
ch The new character
Returns:
A reference to this ICU 2.0

Definition at line 1185 of file unistr.cpp.

References length().

Referenced by TransliteratorTest::TestGurmukhiDevanagari(), RBBITest::TestJapaneseLineBreak(), CollationAPITest::TestMaxExpansion(), UnicodeStringTest::TestMiscellaneous(), and UnicodeStringTest::TestRemoveReplace().

{
  int32_t len = length();
  if(cloneArrayIfNeeded() && len > 0) {
    if(offset < 0) {
      offset = 0;
    } else if(offset >= len) {
      offset = len - 1;
    }

    getArrayStart()[offset] = c;
  }
  return *this;
}


Generated by  Doxygen 1.6.0   Back to index