OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis     
 
Skip Navigation Links
All BooksExpand All Books
Origin CExpand Origin C
Origin C ReferenceExpand Origin C Reference
ClassesExpand Classes
Composite Data TypesExpand Composite Data Types
stringExpand string

2.2.3.11.33 string::SetAt

Description

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.

Syntax

void SetAt( int nIndex, char ch )

Parameters

nIndex
[input]Zero-based index of the character in the string object. The nIndex parameter must be greater than or equal to 0 and less than the value returned by GetLength.
ch
[input]The character to insert.

Return

None.

Examples

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"
}

Remark

See Also

string::GetAt

Header to Include

origin.h

 

© OriginLab Corporation. All rights reserved.