String Sunction.
Stoing u mon poirnitive dota tupe It s also
olkjec o cla.
)a. length () jnd he lengh o he cortain 6nenod
aing
s. chanAG)to Hnà the ith choacte
3)s- isUppe Case C)to check that all chenacter uin
Chanacte uppncase ot mo,
)s. toUpp91 Case C to Convet each chenach en in uppercage
$S isLowen Case CJ to check that all choNacten ü in lowgYrOGe
chaiaie
s. toLownlse c y ’ to convot each oharacen In Cowet coje,
S.isLettel) to check thot all haacter { (ettesn o1 nct.
4, sulbsthing lab)to ex\Hoct/opuy the sting giorn cth
position to (b-1)th positibn
3.tum)it eietes ol he Spares n beginning cind otthe
end
toS. equals Lanoe Caye (s1)’ lt Checjs hat boths and s1 àSame
Staing S2 ASPLRATION
0L234S61AÝindax
Lae sengHie)
Saing Snew to talcQ
thot poejened
input
index stosts yamo
posithon stans 1
s. lnghc
Itgives ac 0ding to position
s. chan At (s)’ "A'
Hgive acoRding to indey
S.toUppen Casel) ’ ASPIRATIoN
S. to Lowes Cale C) aspisation"
chanacie. Isuppelane (a),
chanact e. islower Caselb) 1Ho false
vOniable (chanactg hype)
erample:
(R')’tnue
chanact. isLeHen ( a)tNue
(A') tue
Cwhere ia" u wwed its a boo leen type
S-equal (s1) Hchecls that both s and s1
Oi+5 ce.
SequalIgnaae Case (s)
sising
aafifa'y
S1 AFIFA !
S. equais(s1)e
afifa)
S1 - AFIFA
false Cbceit à cale sensitive, Capital leHen and
Small 1H
i diseort 1 this Statemernt)
tS.subgting ( 3,8); ’RATI
S. taim()’
(ontoins metho ds
dota hge Wnoppet class
Irtead
Doulble
cho Chanocte
Integer.Poo seInt (" to")
input a wotd and pnit
Input ASEIRATIDN
Output
ClassPrint
oublic Siahc void mmain(Stning ancy )
Sconne Scenew Sconnen (Sysiem.in);
Stning
char j
System.Out priotln" Entor the wnyd)y
s~sc.nextLine O',
(= s.length} leten eryarh'os
Sox Ciz0,ie 1;, i) leter
m ethod
wAP to oinput
Hello y name
to add mane spe
class Sentence
public stohic yoid main
Sconntd scz new Scannet (suittm.ln
Stsing s
int i, l co =0)
S-scnextLine
SSt
ine()
)
Cott)
INAP YOieat input a sentence and cOunt the
VOwel n it.
Input’ An Qpple a dau Kerps doch Quway.
no.of vouels 911. U
Impost jaua.u
Clas Vouels
til.
paboli stalk void muin |Staingoxg L)
Scannex ste nha Sxanne (Syakem in),
Stoing Si
int i,lfc=0,
Chon Cy
Sustem out pnintln"nten the senterxe
Ssc.hextlne(}
lzs.length
fonli=b,ie1,i)
Sustm out pnintin ("Numbeno,Vouels Qe:
leHe and i s
each
Sentence ond o i t
NA to
ainpt
AScl value side by side
ASPiaaton
A 65
S 83
import java. uti, t,
clans ASCl
Staric void main ()
pubic
Scanne Seanner (Systen.in) ;
Stoning Sy
iil
thate
System. out poinln"Entey the wotd:
Ssc-nextLinec)
C=g.chon AtCiD)
Sustem.out ptintln (c+;" +
A WAP to input a wd and ount the lunmbe
and Consohent
(Onconot6
clas Nowel-Conaoncut
public state void mainç)
Scanne s hew Sanner (System n)
Stoing ,
cho c)
System:out intln ("Ente theu d
S= Snextlinel
(-s leng +h),
Cchan At(i)j
2Asefe==ls"ep|e== S|ctlle-n
ett)
Systena-at poihtIn |
Sustem . out. pintlo ( Vouwels ane :
System-0ut. pointin (" CGnsonents aei tco,
convet it as shown:
o WAP to input a wand ond
and convet
APft Apple Pp!
inpat jova uhl y
clasa Apple
publie Static vod main)
Sconner sce new Scanne (sytem in))
iGstring sfw""
iot i l
chancj
Systerm.Qud pointtn (Enter the wund)
Ssc-nextLinecs
(=S.length(
t1i0,i<yji+)
c S.chanAt ())
else
System.out -psintin(w)
WAP to input a Sentence and pain each woi d in
igerent lins
Input ’ Hello How Ane You
Output
Hello
How
Ase
You
impott iavauhl^
Sentence
clam
public stotic void main ()
Scannet Sc= new Scannen (ysteroony
SAoing
"
System. out pitln Alwac ane i
Scnextioetsy
S.lengih )
intiyly
chauc
System. out.ptintln ("Enden the Sentene")
S=SC. nextLinel
Systen. outpintIn( All wocli are: "},
Cs.chuAtli);
(e- )
else
wwt/wrd addifon to
3
WAP to input a Sentence ond poit eoch
diysent.
nput
line cwth the no o leteu jn it.
we cl iok tocethen
Qutput we2
tayethen: 2
impo.nt java. uhl.
class Letery
public stahic void main()
Sconne sc = hew Sçanne (Systemin)
Ctaing D),
int iyl
chaj
Sysiem. Out prindln
S=Sc. nextline(0; énto the Senicnce ");
S=S+
(2s. lengan (U;
Syctem.out pointn All wMd one").
eS chan AtCi)
wod extaction
Systern out pinho (w?:wJength ()):,
else
Waite a pooMam to input your mome and pin in the
qhen famat
Input ’ Rata Ram Mohan Rouy Wl w+w.chantA(0).,
Output’R.R.t. Royy W= XR, M
w1 WI+W
’ inport javauti. ; w1 RR.M.Roy
clas Name
pubir Stat'c vord rmain ()
Scann sc= new Scanne(Sy stem.in),
System.0bt pnintEnte
StahegnSckeraline
S+ning w, wi (
Stoing 9,na
chan Cj
System. oui.poiohn(Enter yout mame "J;
S= SC.nextLine D)
la S.len gth j
System. out phin4ln Al ewods ane: ";
C =S.chan At (i);
(C== )
4")
WchanAt (0)
w1: 1+
(
else
Systern. out.phintin
(n1)j
a cwNd and check whethes
Waite a proqan to input
impot java vtil
clas Pallindoane Stning1
Stah'e vold mnain C)
Scanne sc= new Stanne (system.in)
Staíng s we e
int il
chancj Senten
System .ou.paintin Ententhe wetd ");
Se St.nextine
Imgth(y
CS.chan At
Jtetuan type booltan
ystem. out pintin ("Hà a pollind torne wod
else
System out pintln Hù mot apallin dJome
all cuvnd cwhich u
NAP to input a Sentence and piot
pallindo me.
Dad asked mom that did she know onu
nt) mahy alam wosd
utput ’ Dad
Msm
Did
Hakyalan
impagnt java uhil.
clas PalindMame- Shinq 2
bpoteon potimdtometsings
Dsbli Stah Void mGin
SconneSC< neuw
boolean pallinchome (stsing s)
int i
chan C
Shning y
31ehunn truej
else
Mehnn false
Statt'c yoid main)
Pabite
Scanne sc= new Scanner (System ih)
Pallindxorne Stning 2 ob hew Pallindtormeing2|
Stuing
s,
chan c
SESC.neatLinel)
S=S+
Guystem. ouBiaaintn "Alpallfo agtorme wohl)
ane"))
C=S,
chon at
k(obpallindorme(w)
Sy Stem. out'prinaln (w),