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.