C# Programming - Strings - Discussion

Discussion Forum : Strings - General Questions (Q.No. 2)
2.
Which of the following will be the correct output for the C#.NET code snippet given below?
String s1 = "ALL MEN ARE CREATED EQUAL";
String s2;
s2 = s1.Substring(12, 3); 
Console.WriteLine(s2);
ARE
CRE
CR
REA
CREATED
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
12 comments Page 2 of 2.

Somasekhar Kommera said:   1 decade ago
First count the index of the given string its starting from 0th index. So 12th index value is "C", then count from 12th index to next 3 characters. Final answer is "CRE".
(1)

Naveen said:   9 years ago
The count starts from 0 or 1?


Post your comments here:

Your comments will be displayed after verification.