Return a single character specified by an index number.
Get a unicode character in the form of a string at specified position.
char GetAt( int nIndex )
int GetAt( int nIndex, string & str )
A char containing the character at the specified position in the string.
0 if index specified is invalid, 1 if character is ANSI, 2 if character is Unicode
EX1
void string_GetAt_ex1() { string str( "abcdef" ); char chRet = str.GetAt(2); printf("%c\n", chRet);// print: c }
EX2
void GetAt_ex2() { Worksheet wks; wks.Create("origin"); vector<string> vs = {"qw", "er", "ty"}; wks.Columns(0).PutStringArray(vs); for(int nRow = 0; nRow < 3; nRow++) { string str1 = wks.TCell(nRow, 0); string str2; str1.GetAt(1, str2); wks.SetCell(nRow, 1, str2); } }
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::SetAt, string::GetLength
origin.h