0% found this document useful (0 votes)
12 views13 pages

Strings Copy 3

Uploaded by

Yash Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views13 pages

Strings Copy 3

Uploaded by

Yash Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Today's agenda

Char and String


ASCII
Problems
Characters
a Alphabet
a 2 lowercase

A 2 uppercase

b special character
4 ete

C Number
0 1 2 9

Syntan type name character

char ch A

binary no

i w̅
I jivalett
compiler
L l
int n 10

Character Integers
Char ch c

ASCII 256

A 65 a 97 O 48
B 66 s 98 I 49
C 67 c 99 2 50
I l

l
l
l
l
l l
l l l
l

l l l
2 90 z 122 g 57
charsales
1
you can do mathematical operations on characters

answer will be integer


SO
en
p A B 131
65 6

Typecast
2 Char to int implicit
int n e
SOp n 67
implicit
fewcases
3 int to char complicated explicit
fewcases
dotterplicit
always
Char Ch char

Quiz 5 Cenplicit
Quiz 4 Implicit I
Char ch4 A

Char ch2 66 Ch chaschi i3 error

s.o.pe ch4
s.o.p ch2 B
Quiz 1
Chas Chi B
S O p Chi B

Quizz
int n A's
n
2 2

so.p a

Quiz 3
Char 0h3 XYZ error
5 O.p ch3

Quiz 4

Char ch2 char 66

s.o.pe ch2 B
Quiz 5

Char ch4 A Ch
Ch chars chÉi3 error

so.p ch4

Quiz 6
Char Ch5 A

chs 9071
if
s.o.plgreater
3
Smaller
elseh
s smaller
op
3

Break till 10 20 PM
int c are 21,2 3 Collection
ofvariable

listings
collection characters
of
Syntan
4 String St Prep
Algo
St

i i g i
S O St chasat 2
p g
St charAt 2 2

In
string you can't change
Characters directly update not allowed

Charl St f É I I Ii p
5 12 2

Substring Any continuous Part of String


St Prep
String Algo
Are gope
A U erPXx
ALP Xx
String st
AEjfp.si
St substring Éa 45
St substring 0,6
AlgoPo
St substring 5,8 rep

St substring 4,9 error


a Toggle characters
Given a chart which contains only Small and

capital letters toggle them

en ALGOPrep alg PREP


32
A 654 32 a 97
32
B 66 b 98
32

l
l
l
l
A32
2 90 2 122
32

uppercase to lowercase 32
lowercase to uppercase 32
I PSuedo code

void chare ch 4
toggle

int i is cholength 9 74
for
O

che 65 22 Ch i 90 G
TC O N
if
s C 011 Chli char h i A 32
3
else

Chi char Cch i 32

3
3
a Reverse the given String
Given a string str reverse the string

String
reverse
string string St 4

Char I Ch St to chararay

int SP 0

7C O n int eP ch length 1
s c O N

while SP Cep
Char temp Ch TSP
Ch SP Chlep
Cheep temp
SP At
ep_
3
return value ch
3
of
and
Stoing
int C are 11 2,33 Stoing JAI Hello

int C are 2 41 2,3 String 5 2 Hello


head near

É
ink
is iii it
as 0 100 SAI.ch At o

are immutable
strings

String St Hello of
58
4.1
St sa e

2f2
string St Hello engine st.TK
Helloe
for int i O icni.fi 71
St A e n
St
3
N2 T.c
Araylist dynamic array

Array list CInteges at new


Array
List C

at 2 3
1 30 to

al add 10
add at
east al add 20 S op Cal sizes
al add 6307
ty
al add 110

S O p alogeta

a set 2,100

You might also like