Lesson 5 of 34

Strings తో పని చేయడం

9 min 20 XP

Strings తో చాలా ఉపయోగకరమైన methods వస్తాయి. length() పొడవును ఇస్తుంది. charAt(i) స్థానం i వద్ద ఉన్న అక్షరాన్ని ఇస్తుంది, లెక్క 0 నుండి. substring(a, b) a నుండి b వరకు (b తప్ప) భాగాన్ని ఇస్తుంది.

Example: edit me and press Run

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.

Strings ను ఎప్పుడూ == తో పోల్చవద్దు; equals() వాడండి. Capital letters ను పట్టించుకోకుండా పోల్చడానికి equalsIgnoreCase() వాడండి. ఇది interview లో ఇష్టమైన ప్రశ్న!

Example: edit me and press Run

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.

Strings immutable: toUpperCase() వంటి methods కొత్త String ను ఇస్తాయి, అసలుదాన్ని మార్చవు.

Challenge

+20 XP

ఒక పదాన్ని చదివి దాని మొదటి అక్షరం, చివరి అక్షరం, పొడవును print చేయండి. Input: Chennai Output: First: C Last: i Length: 7

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.