Chapter 14
Manipulating Strings
14.1 Introduction
Generally speaking, a string is anything that you can type using the keyboard, including letters, symbols (such as &, *, and @), and digits. In C#, a string is always enclosed in double quotes.
Below is a C# program that uses strings.
a = "Everything enclosed in double quotes is a string, even the numbers: ";
b = "3, 54, 731";
Console.WriteLine(a + b);
Console.WriteLine("You can even mix letters, symbols and digits like this: ");
Console.WriteLine("3 + 4 equals 7");
Many times programs deal with data that comes in the form of strings (text). Strings are everywhere—from word processors, to web browsers, to text messaging programs. Many exercises in this book actually make extensive use of strings. Even though C# supports many useful methods for manipulating strings, this chapter covers only those methods that are necessary for this book's purpose. However, if you need even more information...