Examveda

Which among the following is the correct way to find out the index of second 's' in the string "She sold her beauty in one night to someone else"?

A.

String a = "She sold her beauty in one night to someone else";
int i;
i = a.SecondIndexOf("s");

B.

String a = "She sold her beauty in one night to someone else";
int i, j;
i = a.FirstIndexOf("s");
j = a.IndexOf("s", i + 1);

C.

String a = "She sold her beauty in one night to someone else";
int i, j;
i = a.IndexOf("s");
j = a.IndexOf("s", i + 1);

D. None of the mentioned

Answer: Option C


Join The Discussion

Related Questions on Arrays and Strings in C Sharp