C++ String Assign()
This functions assigns a new value to the string,replacing all its current contents.
Consider two strings str1 and str2, Syntax would be :
str : str is a string object, whose value to be assigned.
subpos : It defines the position of the character which is to be copied as a substring.
sublen : It determines the number of characters of string to be copied in another string object.
n : Number of characters to copy.
ch : Character value to be copied n times
Let's see simple example.
Assigned string is :javatpoint
Let's see simple example when position and length are mentioned in the parameters.
Let's see simple example when n is given.
Assigned string is : javatpoint
Let's see simple example when character value is given in a parameter.