SlideShare a Scribd company logo
1 of 8
C# Tutorial
Part 14:
String
www.siri-kt.blogspot.com
• In C#, string is an object of System.String class
that represent sequence of characters. We can
perform many operations on strings such as
concatenation, comparision, getting substring,
search, trim, replacement etc.
• string vs String
• In C#, string is keyword which is an alias
for System.String class. That is why string and
String are equivalent. We are free to use any
naming convention.
• string s1 = "hello";//creating string using string key
Method Name Description
Clone() It is used to return a reference to this instance of String.
Compare(String,
String)
It is used to compares two specified String objects. It returns an integer
that indicates their relative position in the sort order.
CompareOrdinal(Strin
g, String)
It is used to compare two specified String objects by evaluating the
numeric values of the corresponding Char objects in each string..
CompareTo(String) It is used to compare this instance with a specified String object. It
indicates whether this instance precedes, follows, or appears in the same
position in the sort order as the specified string.
Concat(String, String) It is used to concatenate two specified instances of String.
Contains(String) It is used to return a value indicating whether a specified substring occurs
within this string.
Copy(String) It is used to create a new instance of String with the same value as a
specified String.
CopyTo(Int32,
Char[], Int32,
Int32)
It is used to copy a specified number of characters from a specified position
in this instance to a specified position in an array of Unicode characters.
EndsWith(String) It is used to check that the end of this string instance matches the specified
string.
Equals(String,
String)
It is used to determine that two specified String objects have the same
value.
Format(String,
Object)
It is used to replace one or more format items in a specified string with the
string representation of a specified object.
GetEnumerator() It is used to retrieve an object that can iterate through the individual
characters in this string.
GetHashCode() It returns the hash code for this string.
GetType() It is used to get the Type of the current instance.
GetTypeCode() It is used to return the TypeCode for class String.
IndexOf(String) It is used to report the zero-based index of the first occurrence of the
specified string in this instance.
Insert(Int32,
String)
It is used to return a new string in which a specified string is inserted at a
specified index position.
Intern(String) It is used to retrieve the system's reference to the specified String.
IsInterned(Strin
g)
It is used to retrieve a reference to a specified String.
IsNormalized() It is used to indicate that this string is in Unicode normalization form C.
IsNullOrEmpty(S
tring)
It is used to indicate that the specified string is null or an Empty string.
IsNullOrWhiteS
pace(String)
It is used to indicate whether a specified string is null, empty, or consists only of
white-space characters.
Join(String,
String[])
It is used to concatenate all the elements of a string array, using the specified
separator between each element.
LastIndexOf(Cha
r)
It is used to report the zero-based index position of the last occurrence of a
specified character within String.
LastIndexOfAny(
Char[])
It is used to report the zero-based index position of the last occurrence in this
instance of one or more characters specified in a Unicode array.
Normalize() It is used to return a new string whose textual value is the same as this string,
but whose binary representation is in Unicode normalization form C.
PadLeft(Int32) It is used to return a new string that right-aligns the characters in this instance
by padding them with spaces on the left.
PadRight(Int32) It is used to return a new string that left-aligns the characters in this string by
padding them with spaces on the right.
Remove(Int32) It is used to return a new string in which all the characters in the current
instance, beginning at a specified position and continuing through the last
Split(Char[]) It is used to split a string into substrings that are based on the characters in an
array.
StartsWith(
String)
It is used to check whether the beginning of this string instance matches the
specified string.
Substring(In
t32)
It is used to retrieve a substring from this instance. The substring starts at a
specified character position and continues to the end of the string.
ToCharArray
()
It is used to copy the characters in this instance to a Unicode character array.
ToLower() It is used to convert String into lowercase.
ToLowerInva
riant()
It is used to return convert String into lowercase using the casing rules of the
invariant culture.
ToString() It is used to return instance of String.
ToUpper() It is used to convert String into uppercase.
Trim() It is used to remove all leading and trailing white-space characters from the current
String object.
TrimEnd(Cha
r[])
It Is used to remove all trailing occurrences of a set of characters specified in an
array from the current String object.
TrimStart(C
har[])
It is used to remove all leading occurrences of a set of characters specified in an
array from the current String object.Next TopicC# String Clone()← prevnext →
SIRIKT
Sharing Knowledge is Learning
For more visit our website
www.siri-kt.blogspot.com

More Related Content

What's hot

Arrays in programming
Arrays in programmingArrays in programming
Arrays in programmingTaseerRao
 
Data types in python lecture (2)
Data types in python lecture (2)Data types in python lecture (2)
Data types in python lecture (2)Ali ٍSattar
 
Values and Data types in python
Values and Data types in pythonValues and Data types in python
Values and Data types in pythonJothi Thilaga P
 
Chapter3 basic java data types and declarations
Chapter3 basic java data types and declarationsChapter3 basic java data types and declarations
Chapter3 basic java data types and declarationssshhzap
 
arrays and pointers
arrays and pointersarrays and pointers
arrays and pointersSamiksha Pun
 
Introduction To Programming with Python-4
Introduction To Programming with Python-4Introduction To Programming with Python-4
Introduction To Programming with Python-4Syed Farjad Zia Zaidi
 
Acm aleppo cpc training sixth session
Acm aleppo cpc training sixth sessionAcm aleppo cpc training sixth session
Acm aleppo cpc training sixth sessionAhmad Bashar Eter
 
Strings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothiStrings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothiSowmya Jyothi
 
Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov, Introduction to Python, Lecture3Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov, Introduction to Python, Lecture3Anton Kasyanov
 
Python Collections
Python CollectionsPython Collections
Python Collectionssachingarg0
 
Data Structure In C#
Data Structure In C#Data Structure In C#
Data Structure In C#Shahzad
 

What's hot (19)

Arrays in programming
Arrays in programmingArrays in programming
Arrays in programming
 
Data types in python lecture (2)
Data types in python lecture (2)Data types in python lecture (2)
Data types in python lecture (2)
 
Values and Data types in python
Values and Data types in pythonValues and Data types in python
Values and Data types in python
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
M C6java7
M C6java7M C6java7
M C6java7
 
Regex posix
Regex posixRegex posix
Regex posix
 
Chapter3 basic java data types and declarations
Chapter3 basic java data types and declarationsChapter3 basic java data types and declarations
Chapter3 basic java data types and declarations
 
Strings
StringsStrings
Strings
 
arrays and pointers
arrays and pointersarrays and pointers
arrays and pointers
 
Introduction To Programming with Python-4
Introduction To Programming with Python-4Introduction To Programming with Python-4
Introduction To Programming with Python-4
 
Python Data-Types
Python Data-TypesPython Data-Types
Python Data-Types
 
Acm aleppo cpc training sixth session
Acm aleppo cpc training sixth sessionAcm aleppo cpc training sixth session
Acm aleppo cpc training sixth session
 
Strings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothiStrings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothi
 
Tuple
TupleTuple
Tuple
 
Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov, Introduction to Python, Lecture3Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov, Introduction to Python, Lecture3
 
M C6java2
M C6java2M C6java2
M C6java2
 
Arrays in C++
Arrays in C++Arrays in C++
Arrays in C++
 
Python Collections
Python CollectionsPython Collections
Python Collections
 
Data Structure In C#
Data Structure In C#Data Structure In C#
Data Structure In C#
 

Similar to 13string in c#

Similar to 13string in c# (20)

Strings
StringsStrings
Strings
 
String, string builder, string buffer
String, string builder, string bufferString, string builder, string buffer
String, string builder, string buffer
 
String and string buffer
String and string bufferString and string buffer
String and string buffer
 
stringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptxstringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptx
 
Computer programming 2 Lesson 12
Computer programming 2  Lesson 12Computer programming 2  Lesson 12
Computer programming 2 Lesson 12
 
Strings.ppt
Strings.pptStrings.ppt
Strings.ppt
 
Python strings
Python stringsPython strings
Python strings
 
Module-1 Strings Handling.ppt.pdf
Module-1 Strings Handling.ppt.pdfModule-1 Strings Handling.ppt.pdf
Module-1 Strings Handling.ppt.pdf
 
Module 6 - String Manipulation.pdf
Module 6 - String Manipulation.pdfModule 6 - String Manipulation.pdf
Module 6 - String Manipulation.pdf
 
Java
JavaJava
Java
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Java: Regular Expression
Java: Regular ExpressionJava: Regular Expression
Java: Regular Expression
 
Java String Handling
Java String HandlingJava String Handling
Java String Handling
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and Strings
 
Python data handling
Python data handlingPython data handling
Python data handling
 
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
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9
 
Strings part2
Strings part2Strings part2
Strings part2
 
07slide
07slide07slide
07slide
 
easyPy-Basic.pdf
easyPy-Basic.pdfeasyPy-Basic.pdf
easyPy-Basic.pdf
 

More from Sireesh K (20)

Cn10
Cn10Cn10
Cn10
 
chanakya neeti
chanakya neetichanakya neeti
chanakya neeti
 
chanakya neeti
chanakya neetichanakya neeti
chanakya neeti
 
What is mvc
What is mvcWhat is mvc
What is mvc
 
31c
31c31c
31c
 
31cs
31cs31cs
31cs
 
45c
45c45c
45c
 
44c
44c44c
44c
 
43c
43c43c
43c
 
42c
42c42c
42c
 
41c
41c41c
41c
 
40c
40c40c
40c
 
39c
39c39c
39c
 
38c
38c38c
38c
 
37c
37c37c
37c
 
35c
35c35c
35c
 
34c
34c34c
34c
 
33c
33c33c
33c
 
30c
30c30c
30c
 
29c
29c29c
29c
 

Recently uploaded

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 

Recently uploaded (20)

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 

13string in c#

  • 2. • In C#, string is an object of System.String class that represent sequence of characters. We can perform many operations on strings such as concatenation, comparision, getting substring, search, trim, replacement etc. • string vs String • In C#, string is keyword which is an alias for System.String class. That is why string and String are equivalent. We are free to use any naming convention. • string s1 = "hello";//creating string using string key
  • 3. Method Name Description Clone() It is used to return a reference to this instance of String. Compare(String, String) It is used to compares two specified String objects. It returns an integer that indicates their relative position in the sort order. CompareOrdinal(Strin g, String) It is used to compare two specified String objects by evaluating the numeric values of the corresponding Char objects in each string.. CompareTo(String) It is used to compare this instance with a specified String object. It indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified string. Concat(String, String) It is used to concatenate two specified instances of String. Contains(String) It is used to return a value indicating whether a specified substring occurs within this string. Copy(String) It is used to create a new instance of String with the same value as a specified String.
  • 4. CopyTo(Int32, Char[], Int32, Int32) It is used to copy a specified number of characters from a specified position in this instance to a specified position in an array of Unicode characters. EndsWith(String) It is used to check that the end of this string instance matches the specified string. Equals(String, String) It is used to determine that two specified String objects have the same value. Format(String, Object) It is used to replace one or more format items in a specified string with the string representation of a specified object. GetEnumerator() It is used to retrieve an object that can iterate through the individual characters in this string. GetHashCode() It returns the hash code for this string. GetType() It is used to get the Type of the current instance. GetTypeCode() It is used to return the TypeCode for class String. IndexOf(String) It is used to report the zero-based index of the first occurrence of the specified string in this instance. Insert(Int32, String) It is used to return a new string in which a specified string is inserted at a specified index position.
  • 5. Intern(String) It is used to retrieve the system's reference to the specified String. IsInterned(Strin g) It is used to retrieve a reference to a specified String. IsNormalized() It is used to indicate that this string is in Unicode normalization form C. IsNullOrEmpty(S tring) It is used to indicate that the specified string is null or an Empty string. IsNullOrWhiteS pace(String) It is used to indicate whether a specified string is null, empty, or consists only of white-space characters. Join(String, String[]) It is used to concatenate all the elements of a string array, using the specified separator between each element. LastIndexOf(Cha r) It is used to report the zero-based index position of the last occurrence of a specified character within String. LastIndexOfAny( Char[]) It is used to report the zero-based index position of the last occurrence in this instance of one or more characters specified in a Unicode array. Normalize() It is used to return a new string whose textual value is the same as this string, but whose binary representation is in Unicode normalization form C. PadLeft(Int32) It is used to return a new string that right-aligns the characters in this instance by padding them with spaces on the left. PadRight(Int32) It is used to return a new string that left-aligns the characters in this string by padding them with spaces on the right. Remove(Int32) It is used to return a new string in which all the characters in the current instance, beginning at a specified position and continuing through the last
  • 6. Split(Char[]) It is used to split a string into substrings that are based on the characters in an array. StartsWith( String) It is used to check whether the beginning of this string instance matches the specified string. Substring(In t32) It is used to retrieve a substring from this instance. The substring starts at a specified character position and continues to the end of the string. ToCharArray () It is used to copy the characters in this instance to a Unicode character array. ToLower() It is used to convert String into lowercase. ToLowerInva riant() It is used to return convert String into lowercase using the casing rules of the invariant culture. ToString() It is used to return instance of String. ToUpper() It is used to convert String into uppercase. Trim() It is used to remove all leading and trailing white-space characters from the current String object. TrimEnd(Cha r[]) It Is used to remove all trailing occurrences of a set of characters specified in an array from the current String object. TrimStart(C har[]) It is used to remove all leading occurrences of a set of characters specified in an array from the current String object.Next TopicC# String Clone()← prevnext →
  • 8. For more visit our website www.siri-kt.blogspot.com