मराठी

Describe the purpose of the following function with its syntax: indexOf() - Computer Applications

Advertisements
Advertisements

प्रश्न

Describe the purpose of the following function with its syntax:

indexOf()

कोड लेखन

उत्तर

This function returns the character's index (i.e., position number ) in the String. It returns −1, if the character is not available in the String.

Example: 

String t = "Calculator"; 
  • t.indexOf('u') returns 4.
  • The function t.indexOf('l', 3) returns 5 if 'I' appears after the 3rd place.
  • t.indexOf('b') returns −1 since 'b' does not exist in the String.
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 4: String Handling - EXERCISES [पृष्ठ २८९]

APPEARS IN

अविचल Computer Applications [English] Class 10 ICSE
पाठ 4 String Handling
EXERCISES | Q VIII. 8. | पृष्ठ २८९
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×