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);
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.
Because IndexOf() returns the position of the first occurence of substring.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers