SlideShare une entreprise Scribd logo
1  sur  12
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 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.
Some Methods in System.String
Name              Description


Clone             Returns a reference to this instance of String.

                  Compares two specified String objects and returns
Compare(String,
                  an integer that indicates their relative position in the
String)
                  sort order.
                  Creates the string representation of a specified
Concat(Object)
                  object.
                  Creates a new instance of String with the same
Copy
                  value as a specified String.
                  Returns a value indicating whether the specified
Contains
                  String object occurs within this string.
                  Determines whether this instance and a specified
Equals(Object)    object, which must also be a String object, have the
                  same value.
                  Replaces the format item in a specified string with
Format(String,
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";
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
StringBuilder Members
Name             Description

Append()         Appends a string to the current string.

AppendFormat()   Appends a string that has been worked out from a format
                 specifier
Insert()         Inserts a sub string into the current string

Remove()         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.
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.
Format Strings
SPECIFIE APPLIES TO      MEANING               EXAMPLE
R
C        Numeric types   Locale-specific       $4834.50(US)
                         monetary value        £4834.50(UK)
D        Integer types   General integer       4834
         only
E        Numeric types   Scientific notation   4.384E+003

F        Numeric types   Fixed decimal         4834.50

G        Numeric types   General number        4834.5

N        Numeric types   Common locale-        4,384.50(UK/USA)
                         specific format for   4 384,50(continental
                         numbers               Europe
p        Numeric types   Percentage notation   432,000.00%

X        Integer types   Hexadecimal format    1120(if you want to
         only                                  display 0x1120, you will
REGULAR EXPRESSIONS
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.
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.
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.

Contenu connexe

Tendances (20)

Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classes
 
CSharp Presentation
CSharp PresentationCSharp Presentation
CSharp Presentation
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
Wrapper classes
Wrapper classes Wrapper classes
Wrapper classes
 
Type casting in java
Type casting in javaType casting in java
Type casting in java
 
Basic concept of OOP's
Basic concept of OOP'sBasic concept of OOP's
Basic concept of OOP's
 
C# in depth
C# in depthC# in depth
C# in depth
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 
Strings in c#
Strings in c#Strings in c#
Strings in c#
 
C# basics
 C# basics C# basics
C# basics
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
Scanner class
Scanner classScanner class
Scanner class
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
 
Java input
Java inputJava input
Java input
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
Java Streams
Java StreamsJava Streams
Java Streams
 
Interface in java
Interface in javaInterface in java
Interface in java
 
Collections in-csharp
Collections in-csharpCollections in-csharp
Collections in-csharp
 
Function in C program
Function in C programFunction in C program
Function in C program
 

En vedette (8)

Strings v.1.1
Strings v.1.1Strings v.1.1
Strings v.1.1
 
C# Strings
C# StringsC# Strings
C# Strings
 
Php String And Regular Expressions
Php String  And Regular ExpressionsPhp String  And Regular Expressions
Php String And Regular Expressions
 
Servlets
ServletsServlets
Servlets
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
 
Oops concept on c#
Oops concept on c#Oops concept on c#
Oops concept on c#
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
 

Similaire à C# String

stringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptxstringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptxssuser99ca78
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arraysphanleson
 
13string in c#
13string in c#13string in c#
13string in c#Sireesh K
 
ppt notes python language operators and data
ppt notes python language operators and datappt notes python language operators and data
ppt notes python language operators and dataSukhpreetSingh519414
 
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_06-Dec...
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_06-Dec...FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_06-Dec...
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_06-Dec...jaychoudhary37
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and StringsEduardo Bergavera
 
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSTRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 
Module 6 - String Manipulation.pdf
Module 6 - String Manipulation.pdfModule 6 - String Manipulation.pdf
Module 6 - String Manipulation.pdfMegMeg17
 
Csharp4 strings and_regular_expressions
Csharp4 strings and_regular_expressionsCsharp4 strings and_regular_expressions
Csharp4 strings and_regular_expressionsAbed Bukhari
 
Java: Regular Expression
Java: Regular ExpressionJava: Regular Expression
Java: Regular ExpressionMasudul Haque
 

Similaire à C# String (20)

stringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptxstringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptx
 
String, string builder, string buffer
String, string builder, string bufferString, string builder, string buffer
String, string builder, string buffer
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
 
C# chap 10
C# chap 10C# chap 10
C# chap 10
 
Chapter - 2.pptx
Chapter - 2.pptxChapter - 2.pptx
Chapter - 2.pptx
 
13string in c#
13string in c#13string in c#
13string in c#
 
Adv. python regular expression by Rj
Adv. python regular expression by RjAdv. python regular expression by Rj
Adv. python regular expression by Rj
 
Computer programming 2 Lesson 12
Computer programming 2  Lesson 12Computer programming 2  Lesson 12
Computer programming 2 Lesson 12
 
package
packagepackage
package
 
PHP Web Programming
PHP Web ProgrammingPHP Web Programming
PHP Web Programming
 
3rd june
3rd june3rd june
3rd june
 
2.regular expressions
2.regular expressions2.regular expressions
2.regular expressions
 
Generics collections
Generics collectionsGenerics collections
Generics collections
 
ppt notes python language operators and data
ppt notes python language operators and datappt notes python language operators and data
ppt notes python language operators and data
 
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_06-Dec...
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_06-Dec...FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_06-Dec...
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_06-Dec...
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and Strings
 
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSTRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
 
Module 6 - String Manipulation.pdf
Module 6 - String Manipulation.pdfModule 6 - String Manipulation.pdf
Module 6 - String Manipulation.pdf
 
Csharp4 strings and_regular_expressions
Csharp4 strings and_regular_expressionsCsharp4 strings and_regular_expressions
Csharp4 strings and_regular_expressions
 
Java: Regular Expression
Java: Regular ExpressionJava: Regular Expression
Java: Regular Expression
 

Plus de Raghuveer Guthikonda (8)

Operators & Casts
Operators & CastsOperators & Casts
Operators & Casts
 
Arrays C#
Arrays C#Arrays C#
Arrays C#
 
Generics C#
Generics C#Generics C#
Generics C#
 
Inheritance C#
Inheritance C#Inheritance C#
Inheritance C#
 
Objects and Types C#
Objects and Types C#Objects and Types C#
Objects and Types C#
 
Introduction to C#
Introduction to C#Introduction to C#
Introduction to C#
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET Framework
 
Regex in C#
Regex in C#Regex in C#
Regex in C#
 

Dernier

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 

Dernier (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 

C# String

  • 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. Some Methods in System.String Name Description Clone Returns a reference to this instance of String. Compares two specified String objects and returns Compare(String, an integer that indicates their relative position in the String) sort order. Creates the string representation of a specified Concat(Object) object. Creates a new instance of String with the same Copy value as a specified String. Returns a value indicating whether the specified Contains String object occurs within this string. Determines whether this instance and a specified Equals(Object) object, which must also be a String object, have the same value. Replaces the format item in a specified string with Format(String,
  • 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. 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. StringBuilder Members Name Description Append() Appends a string to the current string. AppendFormat() Appends a string that has been worked out from a format specifier Insert() Inserts a sub string into the current string Remove() 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. 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. Format Strings SPECIFIE APPLIES TO MEANING EXAMPLE R C Numeric types Locale-specific $4834.50(US) monetary value £4834.50(UK) D Integer types General integer 4834 only E Numeric types Scientific notation 4.384E+003 F Numeric types Fixed decimal 4834.50 G Numeric types General number 4834.5 N Numeric types Common locale- 4,384.50(UK/USA) specific format for 4 384,50(continental numbers Europe p Numeric types Percentage notation 432,000.00% X Integer types Hexadecimal format 1120(if you want to only display 0x1120, you will
  • 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. 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. 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.

Notes de l'éditeur

  1. Refer:http://msdn.microsoft.com/en-us/library/system.string.aspx
  2. http://msdn.microsoft.com/en-us/library/dwhawy9k%28v=VS.100%29.aspx