Saturday, March 18, 2017

C++ Part 32

Everything about String

Example Remarks

Source: Absolute C++ by Walter Savitch , Cplus plus reference page,


Parameters

str
Another string object, used entirely (or partially) as the comparing string.
pos
Position of the first character in the compared string.
If this is greater than the string length, it throws out_of_range.
Note: The first character is denoted by a value of 0 (not 1).
len
Length of compared string (if the string is shorter, as many characters as possible).
A value of string::npos indicates all characters until the end of the string.
subpos, sublen
Same as pos and len above, but for the comparing string.
s
Pointer to an array of characters.
If argument n is specified (4), the first n characters in the array are used as the comparing string.
Otherwise (3), a null-terminated sequence is expected: the length of the sequence with the characters to use as comparing string is determined by the first occurrence of a null character.
n
Number of characters to compare.

string str,string str("string"),string str(astring), str[i], str.at(i),str.substr(position length), str1 = str2,str1 +=str2, str.empty(), str1+str2,str.insert(pos str2), 

No comments:

Digital Design Part 3

4th→ assembler translates it to the machine language. 1.6 [20] <§1.6> Consider two diļ¬€erent implementations of the same instru...