C# Programming - Strings - Discussion

Discussion Forum : Strings - General Questions (Q.No. 9)
9.
Which of the following will be the correct output for the C#.NET code snippet given below?
String s1="Kicit";
Console.Write(s1.IndexOf('c') + " "); 
Console.Write(s1.Length);
3 6
2 5
3 5
2 6
3 7
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
12 comments Page 2 of 2.

Ravindra said:   1 decade ago
As you say it returns the position of first occurrence of substring. Answer would be 25 because index staring from 0 position.

Abhitesh Tyagi said:   1 decade ago
Answer would be 35.

Because IndexOf() returns the position of the first occurence of substring.


Post your comments here:

Your comments will be displayed after verification.