String Class
Strings
Purpose
Compare
Concat
CopyTo
IndexOf
Insert
Join
Purpose
Replace
Split
SubString
ToUpper
ToLower
Trim
Building Strings
As you have seen, String is an extremely powerful class that
implements a large number of very useful methods.
it is actually an immutable data type, which means that once you
initialize a string object, that string object can never change.
string greetingText = "Hello from all the guys at Wrox Press. ";
greetingText += "We do hope you enjoy this book as much as we
enjoyed writing it.";
StringBuilder
StringBuilder, which takes an initial string and capacity as its
parameters. StringBuilder sb = new StringBuilder("Hello"); ( OR )
StringBuilder sb = new StringBuilder(20);
Apart from the Length and Capacity properties, there is a readonly MaxCapacity property that indicates the limit to which a
given StringBuilder instance is allowed to grow.
StringBuilder (Contd.)
StringBuilder sb = new StringBuilder("Hello");
sb.Capacity = 100;
The following table lists the main StringBuilder methods.
Method
Purpose
Append
Insert
Remove
Replace
ToString
Regular Expressions
Regular Expressions are used to match the string patterns
we should use the namespace System.Text.RegularExpressions
The regular expressions language is designed specifically for string
processing. It contains two features:
o A set of escape codes for identifying specific types of characters.
o A system for grouping parts of substrings and intermediate
results during a search operation.
Following table contains the regular expression characters
Symbol
Meaning
Symbol
Meaning
\s
\S
\b
Word Boundary
\B
[]
Indicates Range
RegEx
Mathes() Method
MatchCollection
Match
()
Metho
d
Match
GroupCollection
Group
CaptureCollection
Capture
THANK YOU