0% found this document useful (0 votes)
17 views

Java Strings

Uploaded by

Kalluru Supriya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
17 views

Java Strings

Uploaded by

Kalluru Supriya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 12
% Yeading chanel trom string chat (inter) \ ae shenwhich chu PA ve Nore ste ov han chan at given inclew pression + class Trampled arr \ pavm (sting © jargs) pera sch at (DY 0 (st cho WAYOOY hing Ss sri cogdn 7 eek] olp: a ole a % WAP cto print all the single- single characte vs from the aveo shring © class frample 4 ; “ peven Utring 19795) é ching st =" Rani" s Scop dn (st -ehovat (0 c-orpdn (st-dwsat 1) so pln (st-chavatl-) $-0° pln (it Lhar tes) ); h 3 [ee] fpr pg oat Sua eso & psy (sting args) K int length ©) + NM ic a method vohich Length ef the aefiene -the piven ching « €¥ shying ob - sopdn (st-length! Ye lero “2 AAABAAanae * Line to Ar te print all the Hrarecdeye in sthe string by using -tor loop. « eter a é ps vm (string £7 orgs) . 5 shing st z "Helle is Int n= st ee ey, Horlint =o, jaak 5 S44 z che st chavAtli) faruny sop In (eect . enn | [025 BS Gap enn. we (=~ ae Qes ch Ho 805 wees * Lae te pak only apoke chomclen Ina sting - class uu @ shang 52° Krishna eb kv) DARAREAM lel LT 2lz bey FAelsl “hy : ink m= «length od ina j . pe) : Eales * a ae arg > e249 for (int fo ad baw 8 chay chee charAt Ds is(cho= Goan che got A af “er ey che 7% ain er so p dn (ch) 5 y [EEDA [re] Hi _s ap te print ating in vreverse [4 illo eey ovele® + C2i2 Har “ - r [Fear | fee pela Ve Sewn ea h Bere be Ie 10el> . . pases: Ais rae ching s=" Yoge"s Int n= s-length © (OEP eisiona eV paint digits rx ty Cink te n-isieeos | chow che s-charAtl) a S-0 pio Cehy > WAP fe (yrel stad given. shings - [yJel 3] + A. > 3 class #4 g pevn (sk tJ args) dang go test @ Paar 3 zx sting i Ze is a é v s § ee chinyry £ char ch= scharAtlt; _y 4 Cehs -aenxche=54) ces | the, giver fst s-o-pn (ch )y . : s int pe eclength 65 yy tor lint sso bens i++) z char ch- ¢ chant i) Sting +" Dad if(fyr2t=o) gevm (ching arg) nt 9- 6 length¢ u g copIn( hy), + : SRA (int C20 siens itt) 5 ot s& S54 : I act cher che c-charat Cr); . ont La} [eb Gert we(ch--a [ch=2e]) ch==i J) ee tee ehele |Jth==) ly, 324 fry OO £ Ser sopin (eb) s } nes 5 3 ote > dap cto pant ofel index \D™ O43 Opper case character ina ve given sting - Hp Ay +e Maw ot oles a Epon (sting C2A7g 5) £ > Luar te print all +s odd Eis es Extchnes’S. indexed chosecler tn the given ink ne elengthO>; oe ous for Lint ico. jens ie) ¢ £ , pov (string range) thar ch= scharbt Ci) x Te Civ rho) sting 22" kytchna"y © (glass dvden=) Int 1 = s- length; ° 5 pin Chy 5 4 5 ANP ~to print pre intesed pes Ae Characters ina shrine ¢ class Prime Shy / Psum Ceping rags > Bolin 140, 54072 49 , t . £ - ‘ Sting <- geaishnen |: chor che co ett Dy jak 9- S length Od; 14 Gis pam OD ee? dor lint f-o5 fen sine) & bn ich E sopsr Zz they ch-s-chas nt GD: x NE Kauri, fon & + perfed irAod chav che schwAt lid; = WAP te peek poden . nocker ina sting by ink Jeo, jen tse chenee af Wap to peo’k Prine f= = int Want ~ Os Malice here cle in 2 ching | it Ceb4j=-2d > WAP te wont olprabebces 3 char ina cheng. Cait i class Pevtect | spdeHir Public thkte bodiean sPhme\nbis) stofic becler int suro-O . esau: i) -forlink fat piernunn Liss) g ‘ Dum yi = = oy) oes o) © se Guumy,j-e0) & 5 ~ £ >; sumteiy 4 & . sen Sum==num, LL ee aie sven Lt C3079) ¢ Seine ve Vihbw) ytee—e carat © int ne s length OO ¢ Hovlintiz ps ena itt) y chav chs s charab GY if (ispertect (4) => ERD 2 co pla Cchyy y y 5 2+ clare Cont & public dWbie int (sGunkCint num) 2 int C=O. for(int (= 1b te=num sft) $ Cres pum /=109 ¥ getun cy (sting v2 ang) iv nn g . utr te! Shinchan”: g length cep) gocher BEDS into for (jt ino 1697 Now che ig Cie tount C= = .) pet Cit nee el vn, ae eT Ny ae ¢ yy gy x3 ofe: 2 i) Shing SE = “aepidersO3 ink ne skelength (D> Int C=O: Ayr (int eos 129 2 dt) ‘ chor ch= at: chon Ne LY iB(ch> sese4 ches doff ch>=t arche=12>) : = 4 - cc 3 eK, sop in (ch yy ek. : - <> : Chl eee kay Ott, ole a gon PEED |b lel EE pabltc shake int lantOecom za 45 6 ety (Shing 2t, chew c) 4 DY Ar 494, oy one aelergth Udit eNDBA“SL Zag int sails - uly? Aor liek 1-05 : ch FP YE ys Tae chest chant OY ie (h-- 9) oP © otel aay; > al rehun Aoiel : + cles Mainc lass £ pevm (sbing cargo) t lountOceeevane. ("Stas ta’): 4 4 Ona ‘Counting -freanueney of enc characters im given sbAng class proqyare g public chahic int count Oarvances Ceting ck, chare ) t int n= st-length CY int count=Ov for (int i205 less ia) z Chaar che st-chorat Cie if Cche='e9 z bounk + 4 ce 4 metin vwount; 3 s Claes Main Chess : € ' poym (stryargs) Kerishnaven ¢ a . thing ct = wyel ) cfr ing vos te 9 y ja) 4 chav ch =a cha pt L 2 so:pln (count Oceumne. Gt, ch) 4° “4eh Ds 4 JD 3 $ Op j'k Vox 2i | 3s toh _ roa NY {e 2 2 f S WSae fo cownt wabhed hich achor® count 6, values ina obs ng ° = jatrite a method which arefuxP® Count op Syraboels in a shing- > WAP 4p pont max ounving charadkes Ina given ching prosran Manel © pliers chery nq st, char > ao e 2 ole ay Int ne ct lenst OY —> Alar fe print Mint Occerring Int count 89 chawacley na given 44899," forfintteosiens ta ) class Maine los V £ £ cha ch = Slicker nt Cais psvm (st 9 tha & if Cobosta Hehe ete £ “ ny Weh=="otftch== I] Shing st =U Milesy! > Cha A cheeeh= AP Ypohetot CRM min chars st cher at (es Weh=ssot ) INE minfount=oy forint json lens i414) ours , % : _ reo char che st charAtci) IA(minlounk SCount Oecuvancel stys efion counts J leclila) ¢ \ \ ou PS mincher ~ chy class Mainclus mo MIn(ourt:s Count Occurence (shel s ot % pote Derqs) 7 us 20° p tn (minchar), * ing stY = mom", % chan maxchar =sb- chen tlo) 5 i mdi Te sly ota Int morCount =o. ° j oi tot Ut izoyiens v4) TET so only ot ‘etles wall : q cl cd (etl ni oa : char h~ chr rev artr) p . ; we Crotovnts cea Drsnante Gray WPF MPR EY £2 maint occu mar Char achy menComnb = CounbOcunenes C6trih)s, nq cts Hello 5 vat n- sk eon 7c for(int rao ,iensi eD Se che ex chart 1 2 z sopinli) © CE st S preaks + opm 19" + LAP to print 2 ecusarce ob the given sting - al Grete + ass Main class . Fpcum (sh tI eW94) zr 7 sting st - ell y int n =st- length Od; char Co eS int aunts Bt Gin ind; jen 5 i+ 4) char chy seo ALND : ik (the = @) Count ++ break: ° + 2 c Y ws AAnAN HRA KRY? - Se a& Stang ehonocterxs of Ove Stang ( chang hr” Minayales 5 sing Ce for (iat F202 jestlengtoOsi + Qe @ Bed £27 t Oe tes s char ch = st-charAtLY Jy ete = stetch, ¥ s-o-pia (ete D> i Jn [aly aoe ce gee a [ela] s =: 6 PEI aly a LE LSa gee “A 5 cy WAP to clove ant print HF ((Cch=ncaAsicho= a2) j] C. \) Alphabetical letters in given cho aa ch e220) a NE Stengs Con cto setae alpha- é A a | Oe cbele ina given ching: % ° = 7 = YE cting st =" Nactedl; 4 ofp- Motu : shing sty 0"; ae to Store given in reves SP Ta no ats length 35 i a as a “ FAS inns ordercon teverte oa ching, me % pe , ee BaP ae Ngbing st =" Motus rv Phare Me Stchawbe EX ctaing weve" tok ona stelength Or for(int igect 3b jpeoe ie~) itGchs-e5 2a che= Tol] ch>= Vay che= pa) ») 2 eC Sti = stytch 5. char ch= obchow® 7 4 eee ek A) eae 4s-0 pln CsbDy 5 % et so pin Crev dD; “une te "ub uy So o> faloTE Ta] 4] 5 a BS ere [se] BS veg voter: sev [ale Jo [a] a class Program eD - = Stel to “xtotu'! HS rev st ta arg +) co Nn wore, ys ae sorpin (alpha l! ntobut "yy; a Cnt veo, ia st “length ita) . eu SH J TTS patie site Sb ala Oningete) — Charche se aaits, / stemchestes f yy € String ob ye, =° "5 % sor int joy jectetergts0) 5 4) cop de Csi: © deschestechenvay, — PLMID TE) st [uTl=/ 7 ~ Lunr fo store dlphabels, cligits class Replace Separately in o given sting x PSvm Cstcoargs) Store them - : t ‘ Shing «t= "Motu530 Shing t=" Tomy 5 Shing stv 7 "5 cae ee 3 SHRI degit "7 Shing wmnceh< © | rio (int Peo 2 14 st lengthO - aD) chav ‘ new = char eh -'y; chay cheist-char ar G2 -for int i 0; test: lengths it) je (Ch> ©6524 che=40)/ ch>-490 che=192) ) thas c-ct-chov Ati); t WC ch= = new) str= styteh a g B Serhetser ds elce HC chosast exche= 5a) ce = strtnen: t digit = cligibtch , lee = Ss b . 2 . ae aa stv= chy tes 2 . le + oe pin Cinvelif'S; - 3 s sopln (set: Sraaprin € + sto pin tty); iy sor pda (digits we Wap ‘to telus Tue gta given character is present inside otssu re the shing , else vehi fals<- > WAP +o suplace given chara. €18#© programy mcfes {sith Smee chaiader In 8 Eo say (st eT ongs) Sting - A ne Pints mate's) : | s r s gore j Poblic ctadre fedean (string £2) 2 ' oo } thereto: : | te Cintivosy te lores) ar e ' chav che st Unrate G23 it Uch== 2 eee eh 5 % meture trues ede @ ss aetur telse ; & S > Wap to temore duplicate ina geen

You might also like