SetAt
Overwrite a single character specified by an index number. SetAt will not enlarge the string if the index exceeds the bounds of the existing string.
Set a unicode character in the form of a string at the specified position.
void SetAt( int nIndex, char ch )
void SetAt( int nIndex, LPCTSTR pstr )
None.
EX1
void string_SetAt_ex1() { string str( "abcdef" ); str.SetAt(2,'z'); out_str(str);//"abzdef" str.SetAt(8,'z');//if the index exceeds the length of the string,the string stays unchanged out_str(str);//"abzdef" }
EX2
void SetAt_ex2(string str1) { string str2 = "#"; string str3 = str1; str3.SetAt(0, str2); out_str(str3); }
Index can be either byte offset, or character offset, dependent on the system variable @SCOC, which is typicalled controlled by the macro ENABLE_STR_LENGTH_USE_CHAR_COUNT
string::GetAt
origin.h