New course! Every coder should learn Generative AI!
Try a free lesson+ 7
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, sublenSame as pos and len above, but for the comparing string.
hope you understood
+ 2
I think it returns the length of their difference...
Well s2 - s1 results in 'learn' and it's length is 5.
+ 2
Compare means difference here I think so learn has 5 characters so 5 is answer maybe🙇🏻♂️
+ 1
Answer is 5 because compare() will subtract the length of s1 from length of s2
0
Returns >0 when :
Either the value of the first character that does not match is greater in the compared string, or all compared characters match but the compared string is longer.