SlideShare a Scribd company logo
C# Strings
MODULE 6
COURSE INTENDED
LEARNING OUTCOMES
CILO 6:
Construct programs that formats strings.
Wacky Words
Lesson Objectives
Apply the different methods in a C# program.
Explain how they are implemented in C# and process text content.
Learn the different methods for manipulating a text.
“
“Delivering good software
today is often better than
perfect software tomorrow,
so finish things and ship.”
― David Thomas,
String Defined
• A string is a sequence of characters stored in a certain address in
memory.
• In layman’s term, a string is a sequence of characters enclosed in
double quotation marks.
• The class System.String enables us to handle strings in C#.
• For declaring the strings we will continue using the keyword string,
which is an alias in C# of the System.String class from .NET
Framework.
• The work with string facilitates us in manipulating the text content:
construction of texts, text search and many other operations.
Declaring a String Variable
• A string variable is a sequence of characters whose value changes
throughout the program.
• The value of the string depends on the user input.
Syntax:
string variable_name;
string myschool;
Declaring a String Literal
• A string literal, also called a string constant is a sequence of characters
whose value does not changed.
• The value of the string is fixed throughout the program.
Syntax:
string variable_name = “value”;
string my school = “Adamson U”;
Clone()
Returns a reference to this
instance of String.
ToUpper()
ToUpper function converts
string to upper case.
ToLower()
ToLower function converts
string to upper case.
Trim()
Trim function removes extra
spaces from the beginning and
the ending of string.
Contains()
Contains method return bool
value, it checks whether
specified string or character
exist in string or not.
ToCharArray()
Convert a string to array of
character.
Substring()
Substring method returns
substring of a string.
StartsWith()
StartsWith method checks
whether the first character of
a string is same as specified
character .It returns bool
value.
Split()
Split function splits the
string on the supplied
value.It return the array of
string.
Split()
Split function splits the
string on the supplied
value.It return the array of
string.
EndsWith()
Determines whether the end of
this string instance matches a
specified string.
IndexOf()
Reports the zero-based index
of the first occurrence of a
specified Unicode character or
string within this instance.
The method returns -1 if the
character or string is not
found in this instance.
LastIndexOf()
Reports the zero-based index
position of the last
occurrence of a specified
Unicode character or string
within this instance. The
method returns -1 if the
character or string is not
found in this instance.
Replace()
Returns a new string in which
all occurrences of a specified
Unicode character or String in
the current string are
replaced with another
specified Unicode character or
String.
Replace()
Returns a new string in which
all occurrences of a specified
Unicode character or String in
the current string are
replaced with another
specified Unicode character or
String.
Sample Program:
Thanks!
Any questions?
References:
• https://www.tutorialsteacher.com/csharp
• https://www.tutlane.com/tutorial/csharp
• https://www.programiz.com/csharp-programming
• https://www.geeksforgeeks.org

More Related Content

Similar to Module 6 - String Manipulation.pdf

String and string buffer
String and string bufferString and string buffer
String and string buffer
kamal kotecha
 
LectureNotes-04-DSA
LectureNotes-04-DSALectureNotes-04-DSA
LectureNotes-04-DSA
Haitham El-Ghareeb
 
String.pptx
String.pptxString.pptx
String.pptx
RanjithKumar742256
 
Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov, Introduction to Python, Lecture3Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov
 
Strings
StringsStrings
Strings
Saranya saran
 
Engineering CS 5th Sem Python Module -2.pptx
Engineering CS 5th Sem Python Module -2.pptxEngineering CS 5th Sem Python Module -2.pptx
Engineering CS 5th Sem Python Module -2.pptx
hardii0991
 
C UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDYC UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDY
Rajeshkumar Reddy
 
stringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptxstringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptx
ssuser99ca78
 
Dotnet programming concepts difference faqs- 3
Dotnet programming concepts difference faqs- 3Dotnet programming concepts difference faqs- 3
Dotnet programming concepts difference faqs- 3
Umar Ali
 
Python Strings Methods
Python Strings MethodsPython Strings Methods
Python Strings Methods
Mr Examples
 
M C6java7
M C6java7M C6java7
M C6java7
mbruggen
 
String Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and InterfacesString Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and Interfaces
Prabu U
 
String, string builder, string buffer
String, string builder, string bufferString, string builder, string buffer
String, string builder, string buffer
SSN College of Engineering, Kalavakkam
 
Strings in c++
Strings in c++Strings in c++
C programming & data structure [character strings & string functions]
C programming & data structure   [character strings & string functions]C programming & data structure   [character strings & string functions]
C programming & data structure [character strings & string functions]
MomenMostafa
 
Php, mysqlpart2
Php, mysqlpart2Php, mysqlpart2
Php, mysqlpart2
Subhasis Nayak
 
Strings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothiStrings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothi
Sowmya Jyothi
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
phanleson
 
Objective c slide I
Objective c slide IObjective c slide I
Objective c slide I
Diksha Bhargava
 
Strings in c
Strings in cStrings in c
Strings in c
vampugani
 

Similar to Module 6 - String Manipulation.pdf (20)

String and string buffer
String and string bufferString and string buffer
String and string buffer
 
LectureNotes-04-DSA
LectureNotes-04-DSALectureNotes-04-DSA
LectureNotes-04-DSA
 
String.pptx
String.pptxString.pptx
String.pptx
 
Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov, Introduction to Python, Lecture3Anton Kasyanov, Introduction to Python, Lecture3
Anton Kasyanov, Introduction to Python, Lecture3
 
Strings
StringsStrings
Strings
 
Engineering CS 5th Sem Python Module -2.pptx
Engineering CS 5th Sem Python Module -2.pptxEngineering CS 5th Sem Python Module -2.pptx
Engineering CS 5th Sem Python Module -2.pptx
 
C UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDYC UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDY
 
stringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptxstringstringbuilderstringbuffer-190830060142.pptx
stringstringbuilderstringbuffer-190830060142.pptx
 
Dotnet programming concepts difference faqs- 3
Dotnet programming concepts difference faqs- 3Dotnet programming concepts difference faqs- 3
Dotnet programming concepts difference faqs- 3
 
Python Strings Methods
Python Strings MethodsPython Strings Methods
Python Strings Methods
 
M C6java7
M C6java7M C6java7
M C6java7
 
String Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and InterfacesString Handling, Inheritance, Packages and Interfaces
String Handling, Inheritance, Packages and Interfaces
 
String, string builder, string buffer
String, string builder, string bufferString, string builder, string buffer
String, string builder, string buffer
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
 
C programming & data structure [character strings & string functions]
C programming & data structure   [character strings & string functions]C programming & data structure   [character strings & string functions]
C programming & data structure [character strings & string functions]
 
Php, mysqlpart2
Php, mysqlpart2Php, mysqlpart2
Php, mysqlpart2
 
Strings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothiStrings in c mrs.sowmya jyothi
Strings in c mrs.sowmya jyothi
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
 
Objective c slide I
Objective c slide IObjective c slide I
Objective c slide I
 
Strings in c
Strings in cStrings in c
Strings in c
 

Recently uploaded

PrudentRx: A Resource for Patient Education and Engagement
PrudentRx: A Resource for Patient Education and EngagementPrudentRx: A Resource for Patient Education and Engagement
PrudentRx: A Resource for Patient Education and Engagement
PrudentRx Program
 
Tips for Pet Care in winters How to take care of pets.
Tips for Pet Care in winters How to take care of pets.Tips for Pet Care in winters How to take care of pets.
Tips for Pet Care in winters How to take care of pets.
Dinesh Chauhan
 
TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...
TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...
TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...
rightmanforbloodline
 
PrudentRx's Function in the Management of Chronic Illnesses
PrudentRx's Function in the Management of Chronic IllnessesPrudentRx's Function in the Management of Chronic Illnesses
PrudentRx's Function in the Management of Chronic Illnesses
PrudentRx Program
 
Professional Secrecy: Forensic Medicine Lecture
Professional Secrecy: Forensic Medicine LectureProfessional Secrecy: Forensic Medicine Lecture
Professional Secrecy: Forensic Medicine Lecture
DIVYANSHU740006
 
RECENT ADVANCES IN BREAST CANCER RADIOTHERAPY
RECENT ADVANCES IN BREAST CANCER RADIOTHERAPYRECENT ADVANCES IN BREAST CANCER RADIOTHERAPY
RECENT ADVANCES IN BREAST CANCER RADIOTHERAPY
Isha Jaiswal
 
Rate Controlled Drug Delivery Systems.pdf
Rate Controlled Drug Delivery Systems.pdfRate Controlled Drug Delivery Systems.pdf
Rate Controlled Drug Delivery Systems.pdf
Rajarambapu College of Pharmacy Kasegaon Dist Sangli
 
INFECTION OF THE BRAIN -ENCEPHALITIS ( PPT)
INFECTION OF THE BRAIN -ENCEPHALITIS ( PPT)INFECTION OF THE BRAIN -ENCEPHALITIS ( PPT)
INFECTION OF THE BRAIN -ENCEPHALITIS ( PPT)
blessyjannu21
 
Feeding plate for a newborn with Cleft Palate.pptx
Feeding plate for a newborn with Cleft Palate.pptxFeeding plate for a newborn with Cleft Palate.pptx
Feeding plate for a newborn with Cleft Palate.pptx
SatvikaPrasad
 
Dr. David Greene R3 stem cell Breakthroughs: Stem Cell Therapy in Cardiology
Dr. David Greene R3 stem cell Breakthroughs: Stem Cell Therapy in CardiologyDr. David Greene R3 stem cell Breakthroughs: Stem Cell Therapy in Cardiology
Dr. David Greene R3 stem cell Breakthroughs: Stem Cell Therapy in Cardiology
R3 Stem Cell
 
Pediatric Emergency Care for Children | Apollo Hospital
Pediatric Emergency Care for Children | Apollo HospitalPediatric Emergency Care for Children | Apollo Hospital
Pediatric Emergency Care for Children | Apollo Hospital
Apollo 24/7 Adult & Paediatric Emergency Services
 
Stem Cell Solutions: Dr. David Greene's Path to Non-Surgical Cardiac Care
Stem Cell Solutions: Dr. David Greene's Path to Non-Surgical Cardiac CareStem Cell Solutions: Dr. David Greene's Path to Non-Surgical Cardiac Care
Stem Cell Solutions: Dr. David Greene's Path to Non-Surgical Cardiac Care
Dr. David Greene Arizona
 
NKTI Annual Report - Annual Report FY 2022
NKTI Annual Report - Annual Report FY 2022NKTI Annual Report - Annual Report FY 2022
NKTI Annual Report - Annual Report FY 2022
nktiacc3
 
Letter to MREC - application to conduct study
Letter to MREC - application to conduct studyLetter to MREC - application to conduct study
Letter to MREC - application to conduct study
Azreen Aj
 
Gemma Wean- Nutritional solution for Artemia
Gemma Wean- Nutritional solution for ArtemiaGemma Wean- Nutritional solution for Artemia
Gemma Wean- Nutritional solution for Artemia
smuskaan0008
 
Hypotension and role of physiotherapy in it
Hypotension and role of physiotherapy in itHypotension and role of physiotherapy in it
Hypotension and role of physiotherapy in it
Vishal kr Thakur
 
PET CT beginners Guide covers some of the underrepresented topics in PET CT
PET CT  beginners Guide  covers some of the underrepresented topics  in PET CTPET CT  beginners Guide  covers some of the underrepresented topics  in PET CT
PET CT beginners Guide covers some of the underrepresented topics in PET CT
MiadAlsulami
 
Vicarious movements or trick movements_AB.pdf
Vicarious movements or trick movements_AB.pdfVicarious movements or trick movements_AB.pdf
Vicarious movements or trick movements_AB.pdf
Arunima620542
 
Innovative Minds France's Most Impactful Healthcare Leaders.pdf
Innovative Minds France's Most Impactful Healthcare Leaders.pdfInnovative Minds France's Most Impactful Healthcare Leaders.pdf
Innovative Minds France's Most Impactful Healthcare Leaders.pdf
eurohealthleaders
 
Under Pressure : Kenneth Kruk's Strategy
Under Pressure : Kenneth Kruk's StrategyUnder Pressure : Kenneth Kruk's Strategy
Under Pressure : Kenneth Kruk's Strategy
Kenneth Kruk
 

Recently uploaded (20)

PrudentRx: A Resource for Patient Education and Engagement
PrudentRx: A Resource for Patient Education and EngagementPrudentRx: A Resource for Patient Education and Engagement
PrudentRx: A Resource for Patient Education and Engagement
 
Tips for Pet Care in winters How to take care of pets.
Tips for Pet Care in winters How to take care of pets.Tips for Pet Care in winters How to take care of pets.
Tips for Pet Care in winters How to take care of pets.
 
TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...
TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...
TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...
 
PrudentRx's Function in the Management of Chronic Illnesses
PrudentRx's Function in the Management of Chronic IllnessesPrudentRx's Function in the Management of Chronic Illnesses
PrudentRx's Function in the Management of Chronic Illnesses
 
Professional Secrecy: Forensic Medicine Lecture
Professional Secrecy: Forensic Medicine LectureProfessional Secrecy: Forensic Medicine Lecture
Professional Secrecy: Forensic Medicine Lecture
 
RECENT ADVANCES IN BREAST CANCER RADIOTHERAPY
RECENT ADVANCES IN BREAST CANCER RADIOTHERAPYRECENT ADVANCES IN BREAST CANCER RADIOTHERAPY
RECENT ADVANCES IN BREAST CANCER RADIOTHERAPY
 
Rate Controlled Drug Delivery Systems.pdf
Rate Controlled Drug Delivery Systems.pdfRate Controlled Drug Delivery Systems.pdf
Rate Controlled Drug Delivery Systems.pdf
 
INFECTION OF THE BRAIN -ENCEPHALITIS ( PPT)
INFECTION OF THE BRAIN -ENCEPHALITIS ( PPT)INFECTION OF THE BRAIN -ENCEPHALITIS ( PPT)
INFECTION OF THE BRAIN -ENCEPHALITIS ( PPT)
 
Feeding plate for a newborn with Cleft Palate.pptx
Feeding plate for a newborn with Cleft Palate.pptxFeeding plate for a newborn with Cleft Palate.pptx
Feeding plate for a newborn with Cleft Palate.pptx
 
Dr. David Greene R3 stem cell Breakthroughs: Stem Cell Therapy in Cardiology
Dr. David Greene R3 stem cell Breakthroughs: Stem Cell Therapy in CardiologyDr. David Greene R3 stem cell Breakthroughs: Stem Cell Therapy in Cardiology
Dr. David Greene R3 stem cell Breakthroughs: Stem Cell Therapy in Cardiology
 
Pediatric Emergency Care for Children | Apollo Hospital
Pediatric Emergency Care for Children | Apollo HospitalPediatric Emergency Care for Children | Apollo Hospital
Pediatric Emergency Care for Children | Apollo Hospital
 
Stem Cell Solutions: Dr. David Greene's Path to Non-Surgical Cardiac Care
Stem Cell Solutions: Dr. David Greene's Path to Non-Surgical Cardiac CareStem Cell Solutions: Dr. David Greene's Path to Non-Surgical Cardiac Care
Stem Cell Solutions: Dr. David Greene's Path to Non-Surgical Cardiac Care
 
NKTI Annual Report - Annual Report FY 2022
NKTI Annual Report - Annual Report FY 2022NKTI Annual Report - Annual Report FY 2022
NKTI Annual Report - Annual Report FY 2022
 
Letter to MREC - application to conduct study
Letter to MREC - application to conduct studyLetter to MREC - application to conduct study
Letter to MREC - application to conduct study
 
Gemma Wean- Nutritional solution for Artemia
Gemma Wean- Nutritional solution for ArtemiaGemma Wean- Nutritional solution for Artemia
Gemma Wean- Nutritional solution for Artemia
 
Hypotension and role of physiotherapy in it
Hypotension and role of physiotherapy in itHypotension and role of physiotherapy in it
Hypotension and role of physiotherapy in it
 
PET CT beginners Guide covers some of the underrepresented topics in PET CT
PET CT  beginners Guide  covers some of the underrepresented topics  in PET CTPET CT  beginners Guide  covers some of the underrepresented topics  in PET CT
PET CT beginners Guide covers some of the underrepresented topics in PET CT
 
Vicarious movements or trick movements_AB.pdf
Vicarious movements or trick movements_AB.pdfVicarious movements or trick movements_AB.pdf
Vicarious movements or trick movements_AB.pdf
 
Innovative Minds France's Most Impactful Healthcare Leaders.pdf
Innovative Minds France's Most Impactful Healthcare Leaders.pdfInnovative Minds France's Most Impactful Healthcare Leaders.pdf
Innovative Minds France's Most Impactful Healthcare Leaders.pdf
 
Under Pressure : Kenneth Kruk's Strategy
Under Pressure : Kenneth Kruk's StrategyUnder Pressure : Kenneth Kruk's Strategy
Under Pressure : Kenneth Kruk's Strategy
 

Module 6 - String Manipulation.pdf