Question: Common methods for the String class . Substring public String Substring(int start todex) Summary: Retrieves a substring from this instance. The substring starts at a

 Common methods for the String class . Substring public String Substring(intstart todex) Summary: Retrieves a substring from this instance. The substring starts

Common methods for the String class . Substring public String Substring(int start todex) Summary: Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end of the string. Parameter: startIndex: the zero-based starting character position of a substring in this instance Returns: A string that is equivalent to the substring that begins at startIndex in this instance, or System String Empty if startIndex is equal to the length of this instance. . . Example string school = "Georgia Gwinnett College": Console.WriteLine( school Substring(8) ); // Displays "Gwinnett College" Console.Writel.ine schoolSubstring(17) ); // Displays Console.WriteLineschool Substring(21) ); // Displays o G e O r g i a G 0 1 2 3 4 5 6 7 8 w 9 i n e 10 | 11 12 13 t 15 17 1 19 e g e 20 21 22 23 14 16 18 . . Substring public String Substring(int startIndex, int length) Summary: Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length. Parameters: startIndex: The zero-based starting character position of a substring in this instance length: number of characters in the substring Returns: A string that is equivalent to the substring of length Length that begins at startIndex in this instance, or SysteneString Empty if startIndex is equal to the length of this instance and length is zero. Example string school = "Georgia Gwinnett College": Console.WriteLine school Substring(0,5)); // Displays "Georg" Console.Writel.inel school Substring(8,4) ); // Displays Console.WriteLine( school. Substring(12,3) ); // Displays i a G w i n t o 1 1 g e G e o r 0 | 1 2 3 g 4 e 13 t 15 17 e 21 5 6 7 8 9 10 11 12 14 16 18 19 20 22 23 ToLower public String Tel.owere) Summary: Returns a copy of this string converted to lowercase. Returns: The lowercase equivalent of the current string . Example string abbrev = "GGC": string smallAbbrev = abbrev. Tolower(); Console.WriteLine(abbrev ); // Displays Console.WriteLine(smal Abbrev // Displays ToUpper public String ToUppere) Summary: Returns a copy of this string converted to uppercase. Returns: The uppercase equivalent of the current string Example string name = "Natalie" string bigName = name Toupper(); Console.WriteLine(name); Console.WriteLine(bigName); // Displays // Displays EndsWith and StartsWith public bool EndsWith(String value) Summary: Determines whether the end of this string instance matches the specified string Parameter: value: The string to compare to the substring at the end of this instance Returns: true if value matches the end of this instance; otherwise, false public bool StartsWith String value) Summary: Determines whether the beginning of this string instance matches the specified string Parameter: value: The string to compare to the substring at the beginning of this instance Returns: true if value matches the end of this instance; otherwise, false . // Displays Example string city = "Lawrenceville: Console.WriteLineL city EndsWith("le")); Console.WriteLineL city EndsWith("LE")); Console.WriteLinel_cityStartsWith("K")); Console.WriteLine_city StartsWith("Law")); // Displays // Displays // Displays

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!