Complete the code to convert the string to uppercase.
string text = "hello"; string result = text.[1]();
The ToUpper() method converts all characters in the string to uppercase.
Complete the code to check if the string starts with "Hi".
string greeting = "Hi there!"; bool startsWithHi = greeting.[1]("Hi");
The StartsWith() method checks if the string begins with the specified substring.
Fix the error in the code to find the position of 'a' in the string.
string word = "banana"; int position = word.[1]('a');
The IndexOf() method returns the position of the first occurrence of a character.
Fill both blanks to create a substring from index 2 with length 4.
string text = "Programming"; string part = text.[1]([2], 4);
The Substring method extracts part of the string starting at the given index. Here, index 2 means starting from the third character.
Fill all three blanks to replace 'cat' with 'dog' in the string.
string sentence = "The cat sat on the mat."; string newSentence = sentence.[1]("[2]", "[3]");
The Replace method replaces all occurrences of a substring with another substring.