O'Reilly logo

Learning C# 2005, 2nd Edition by Brian MacDonald, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 15. Strings

There was a time (long, long ago, when the earth was still molten and I was in high school) when people thought of computers as manipulating numeric values exclusively. Among the first use of computers was to calculate missile trajectories during World War II, and for a very long time, programming was taught in the math department of major universities.

Today, most programs are concerned more with manipulating and displaying strings of characters than with strings of numbers. Typically, these strings are used for word processing, document manipulation, and creation of web pages.

C# provides built-in support for a fully functional string type. More importantly, C# treats strings as objects that encapsulate all the manipulation, sorting, and searching methods normally applied to strings of characters.

Tip

The .NET Framework provides a String class (uppercase “S”). The C# language offers an alias to the String class as the string class (lowercase “s”). These class names are interchangeable, and you are free to use either upper- or lowercase.

Complex string manipulation and pattern matching is aided by the use of regular expressions.

Tip

Regular expressions are a powerful technology for describing and manipulating text. Underlying regular expressions is a technique called pattern matching, which involves comparing one string to another, or comparing a series of wildcards that represent a type of string to a literal string. A regular expression is applied to a string—that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required