Chapter 4. Strings and Regular Expressions


IN BRIEF

This chapter covers .NET strings and their manipulation, along with the very powerful feature of regular expressions. The first section deals with the .NET String class. You will learn about the workings of .NET strings, formatting, and manipulation of .NET strings.

The second section deals with the StringBuilder class. You will learn efficient ways to handle string concatenation and manipulation.

The final section deals with regular expressions. You will learn to apply this powerful engine for matching, grouping, validating, and replacing strings.

WHAT YOU NEED

RECOMMENDED SOFTWARE

.NET Framework

Visual Studio .NET

RECOMMENDED HARDWARE

.NET-enabled desktop client

SKILLS REQUIRED

C# coding


STRINGS AND REGULAR EXPRESSIONS AT A GLANCE

String Basics

75

  
 

Understanding the Immutability of Strings

75

Splitting Strings

82

Modifying Case

82

 

Applying Formatting to Strings

75

The StringBuilder

83

 

Using Escape Sequences

79

Appending Values

83

 

Locating Substrings

80

Using AppendFormat

83

 

Adding Padding

80

Inserting Strings

83

 

Trimming Characters

81

Replacing Strings and Characters

84

 

Replacing Characters

81

Removing Substrings

84

Using Regular Expressions

85

  
 

Understanding Expression Syntax

85

  

How to Use Matching

85

  
 

Validating Data with Regular Expressions

89

Grouping Matches

89

   

Replacing Matched Strings

90

Summary

91

  

Further Reading

91

  




    Visual C#. NET 2003 Unleashed
    Visual C#. NET 2003 Unleashed
    ISBN: 672326760
    EAN: N/A
    Year: 2003
    Pages: 316

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net