STRINGSExamining System.StringBuilding StringsStringBuilder ClassFormat Strings
System.String A string is a sequential collection of Unicode characters  that is used to represent text. A String object...
Some Methods in System.StringName              DescriptionClone             Returns a reference to this instance of String...
Building Strings String is an extremely powerful class that implements a  large number of very useful methods. However, ...
StringBuilder Class Represents a mutable string of characters. This class  cannot be inherited. Namespace is System.Test...
StringBuilder MembersName             DescriptionAppend()         Appends a string to the current string.AppendFormat()   ...
Format Strings Standard numeric format strings are used to format  common numeric types. A standard numeric format strin...
Format StringsSPECIFIE APPLIES TO      MEANING               EXAMPLERC        Numeric types   Locale-specific       $4834....
REGULAR EXPRESSIONS
Regular Expressions Regular expressions provide a powerful, flexible, and  efficient method for processing text. The ext...
Regular Expressions Regular expressions are part of those small technology  areas that are incredibly useful in a wide ra...
How Regular Expressions Work The centerpiece of text processing with regular  expressions is the regular expression engin...
Upcoming SlideShare
Loading in...5
×

C# String

941

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
941
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
37
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • Refer:http://msdn.microsoft.com/en-us/library/system.string.aspx
  • http://msdn.microsoft.com/en-us/library/dwhawy9k%28v=VS.100%29.aspx
  • C# String

    1. 1. STRINGSExamining System.StringBuilding StringsStringBuilder ClassFormat Strings
    2. 2. System.String A string is a sequential collection of Unicode characters that is used to represent text. A String object is a sequential collection of System.Char objects that represent a string. The value of the String object is the content of the sequential collection, and that value is immutable. A String object is called immutable (read-only) because its value cannot be modified once it has been created.
    3. 3. Some Methods in System.StringName DescriptionClone Returns a reference to this instance of String. Compares two specified String objects and returnsCompare(String, an integer that indicates their relative position in theString) sort order. Creates the string representation of a specifiedConcat(Object) object. Creates a new instance of String with the sameCopy value as a specified String. Returns a value indicating whether the specifiedContains String object occurs within this string. Determines whether this instance and a specifiedEquals(Object) object, which must also be a String object, have the same value. Replaces the format item in a specified string withFormat(String,
    4. 4. Building Strings String is an extremely powerful class that implements a large number of very useful methods. However, the String class has a short coming that makes it very inefficient for making repeated modifications to given string. For example, when you write fallowing code, the compiler actually creates a new string object to hold the new sequence of characters, and that new object is assigned to b. The string "h" is then eligible for garbage collection. Example: string b = "h"; b += "ello";
    5. 5. StringBuilder Class Represents a mutable string of characters. This class cannot be inherited. Namespace is System.Test This class represents a string-like object whose value is a mutable sequence of characters. The value is said to be mutable because it can be modified once it has been created by appending, removing, replacing, or inserting characters.  For Example:  StringBuilder text=new StringBuilder (“….String …”,size);//size is an integer  Text.AppendForamt(“New String….”);  This code sets an initial capacity of size for StringBuilder
    6. 6. StringBuilder MembersName DescriptionAppend() Appends a string to the current string.AppendFormat() Appends a string that has been worked out from a format specifierInsert() Inserts a sub string into the current stringRemove() Removes characters from the current string.Replace() Replaces all occurrences of a character with another character or a substring with another substring in the current string.ToString() Returns the current string cast to a System.String object.
    7. 7. Format Strings Standard numeric format strings are used to format common numeric types. A standard numeric format string takes the form Axx, where A is an alphabetic character called the format specifier, and xx is an optional integer called the precision specifier. The precision specifier ranges from 0 to 99 and affects the number of digits in the result. Any numeric format string that contains more than one alphabetic character, including white space, is interpreted as a custom numeric format string.
    8. 8. Format StringsSPECIFIE APPLIES TO MEANING EXAMPLERC Numeric types Locale-specific $4834.50(US) monetary value £4834.50(UK)D Integer types General integer 4834 onlyE Numeric types Scientific notation 4.384E+003F Numeric types Fixed decimal 4834.50G Numeric types General number 4834.5N Numeric types Common locale- 4,384.50(UK/USA) specific format for 4 384,50(continental numbers Europep Numeric types Percentage notation 432,000.00%X Integer types Hexadecimal format 1120(if you want to only display 0x1120, you will
    9. 9. REGULAR EXPRESSIONS
    10. 10. Regular Expressions Regular expressions provide a powerful, flexible, and efficient method for processing text. The extensive pattern-matching notation of regular expressions enables you to quickly parse large amounts of text to find specific character patterns; to validate text to ensure that it matches a predefined pattern (such as an e-mail address); to extract, edit, replace, or delete text substrings; and to add the extracted strings to a collection in order to generate a report. For many applications that deal with strings or that parse large blocks of text, regular expressions are an indispensable tool.
    11. 11. Regular Expressions Regular expressions are part of those small technology areas that are incredibly useful in a wide range of programs, yet rarely used among developers. You can think regular expressions as a mini- programming language with one specific scope: to locate substrings within a large string expression.
    12. 12. How Regular Expressions Work The centerpiece of text processing with regular expressions is the regular expression engine, which is represented by the System.Text.RegularExpressions.Regex object in the .NET Framework. At a minimum, processing text using regular expressions requires that the regular expression engine be provided with the following two items of information:  The regular expression pattern to identify in the text.  The text to parse for the regular expression pattern.
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×