logo CodeStepByStep logo

MarshallMathers

Language/Type: C# string

Given the following variable declarations:

// index       0123456789012345678901234
string s1   = "Snoop Dogg";
string s2   = "Marshall 'Eminem' Mathers";
string s3   = s2.Substring(18);
string book = "Art & Science of C#";

Give the results of the following expressions. Make sure to indicate a value of the proper type (e.g. strings in " " quotes).

s1.Length
s2.Length
s1.IndexOf("o")
s2.IndexOf("x")
s1.Substring(6, 3)
s2.Substring(21)
book.Substring(6, 6)
s3.ToLower()

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.