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. ...

Get C# and Algorithmic Thinking for the Complete Beginner now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.