A string carries methods of its own. A few you will reach for constantly:
Program.cs
using System;
class Program
{
static void Main()
{
string name = " Ada Lovelace ";
Console.WriteLine(name.Trim());
Console.WriteLine(name.Trim().ToUpper());
Console.WriteLine(name.Trim().Length);
Console.WriteLine(name.Contains("Ada"));
}
}
Output
Ada Lovelace ADA LOVELACE 12 True
Strings do not change
ToUpper() returns a new string; it does not modify the original. That is why you chain the calls rather than expecting name to have changed.