SlideShare a Scribd company logo
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 (19)

PPTX
Arrays in programming
TaseerRao
 
PPTX
Data types in python lecture (2)
Ali ٍSattar
 
PPTX
Values and Data types in python
Jothi Thilaga P
 
PPTX
Lecture 7
Mohammed Khan
 
PPT
M C6java7
mbruggen
 
PPTX
Regex posix
sana mateen
 
PPT
Chapter3 basic java data types and declarations
sshhzap
 
PPTX
Strings
Saranya saran
 
PPTX
arrays and pointers
Samiksha Pun
 
PPTX
Introduction To Programming with Python-4
Syed Farjad Zia Zaidi
 
PPTX
Python Data-Types
Akhil Kaushik
 
PDF
Acm aleppo cpc training sixth session
Ahmad Bashar Eter
 
PDF
Strings in c mrs.sowmya jyothi
Sowmya Jyothi
 
PPTX
Tuple
LearningTech
 
PDF
Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov
 
PPT
M C6java2
mbruggen
 
PPTX
Arrays in C++
Kashif Nawab
 
PPTX
Python Collections
sachingarg0
 
PPT
Data Structure In C#
Shahzad
 
Arrays in programming
TaseerRao
 
Data types in python lecture (2)
Ali ٍSattar
 
Values and Data types in python
Jothi Thilaga P
 
Lecture 7
Mohammed Khan
 
M C6java7
mbruggen
 
Regex posix
sana mateen
 
Chapter3 basic java data types and declarations
sshhzap
 
Strings
Saranya saran
 
arrays and pointers
Samiksha Pun
 
Introduction To Programming with Python-4
Syed Farjad Zia Zaidi
 
Python Data-Types
Akhil Kaushik
 
Acm aleppo cpc training sixth session
Ahmad Bashar Eter
 
Strings in c mrs.sowmya jyothi
Sowmya Jyothi
 
Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov
 
M C6java2
mbruggen
 
Arrays in C++
Kashif Nawab
 
Python Collections
sachingarg0
 
Data Structure In C#
Shahzad
 

Similar to 13string in c# (20)

PPT
Strings
naslin prestilda
 
PPTX
String, string builder, string buffer
SSN College of Engineering, Kalavakkam
 
PPS
String and string buffer
kamal kotecha
 
PPTX
stringstringbuilderstringbuffer-190830060142.pptx
ssuser99ca78
 
PPT
Strings power point in detail with examples
rabiyanaseer1
 
PPTX
Computer programming 2 Lesson 12
MLG College of Learning, Inc
 
PPT
Strings.ppt
SanthiyaAK
 
PPTX
StringBuffer examples.pptxStringBuffer examples.pptxStringBuffer examples.pptx
yatakonakiran2
 
PDF
Python strings
Mohammed Sikander
 
PDF
Module-1 Strings Handling.ppt.pdf
learnEnglish51
 
PDF
Module 6 - String Manipulation.pdf
MegMeg17
 
PPTX
Java
JahnaviBhagat
 
PDF
Lecture 7
Debasish Pratihari
 
PPTX
Arrays and Strings engineering education
csangani1
 
PPTX
Java: Regular Expression
Masudul Haque
 
PPTX
Java String Handling
Infoviaan Technologies
 
PPT
Chapter 9 - Characters and Strings
Eduardo Bergavera
 
PPT
Java Strings methods and operations.ppt
JyothiAmpally
 
PDF
Python data handling
Prof. Dr. K. Adisesha
 
PDF
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
SowmyaJyothi3
 
String, string builder, string buffer
SSN College of Engineering, Kalavakkam
 
String and string buffer
kamal kotecha
 
stringstringbuilderstringbuffer-190830060142.pptx
ssuser99ca78
 
Strings power point in detail with examples
rabiyanaseer1
 
Computer programming 2 Lesson 12
MLG College of Learning, Inc
 
Strings.ppt
SanthiyaAK
 
StringBuffer examples.pptxStringBuffer examples.pptxStringBuffer examples.pptx
yatakonakiran2
 
Python strings
Mohammed Sikander
 
Module-1 Strings Handling.ppt.pdf
learnEnglish51
 
Module 6 - String Manipulation.pdf
MegMeg17
 
Arrays and Strings engineering education
csangani1
 
Java: Regular Expression
Masudul Haque
 
Java String Handling
Infoviaan Technologies
 
Chapter 9 - Characters and Strings
Eduardo Bergavera
 
Java Strings methods and operations.ppt
JyothiAmpally
 
Python data handling
Prof. Dr. K. Adisesha
 
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
SowmyaJyothi3
 
Ad

More from Sireesh K (20)

PPTX
Cn10
Sireesh K
 
PPTX
chanakya neeti
Sireesh K
 
PPTX
chanakya neeti
Sireesh K
 
DOCX
What is mvc
Sireesh K
 
PPTX
31c
Sireesh K
 
PPTX
31cs
Sireesh K
 
PPTX
45c
Sireesh K
 
PPTX
44c
Sireesh K
 
PPTX
43c
Sireesh K
 
PPTX
42c
Sireesh K
 
PPTX
41c
Sireesh K
 
PPTX
40c
Sireesh K
 
PPTX
39c
Sireesh K
 
PPTX
38c
Sireesh K
 
PPTX
37c
Sireesh K
 
PPTX
35c
Sireesh K
 
PPTX
34c
Sireesh K
 
PPTX
33c
Sireesh K
 
PPTX
30c
Sireesh K
 
PPTX
29c
Sireesh K
 
Cn10
Sireesh K
 
chanakya neeti
Sireesh K
 
chanakya neeti
Sireesh K
 
What is mvc
Sireesh K
 
31cs
Sireesh K
 
Ad

Recently uploaded (20)

PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Dimensions of Societal Planning in Commonism
StefanMz
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 

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