Skip to content
Justice Tech School

C# Strings

Strings are immutable sequences of characters. Common members: Length, ToUpper, ToLower, Substring, Replace, Contains, StartsWith, Trim, Split and Join.

Example
string s = "Hello, C#";
Console.WriteLine($"{s.Length} {s.ToUpper()} {s.Substring(7)}");
Console.WriteLine(s.Replace("C#", "World"));
Console.WriteLine(string.Join("-", "a,b,c".Split(',')));

Exercise

Get the length.

s.

Quiz Test

Can you change a string in place?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.