How To Get The Index Of A String? Code Example

Snippet 1

  str.index(sub[, start[, end]] ) 

Snippet 2

    // Initialising String 
        String gfg = new String("Welcome to geeksforgeeks"); 
  
        System.out.print("Found g first at position : "); 
  
        // Initial index of 'g' will print 
        // prints 11 
        System.out.println(gfg.indexOf('g'));  

Similar Snippets


Creating Java Main Method Code Example – java

Find Duplicates In Arraylist Java Code Example – java

Java Creat A Folder Code Example – java

Firestore Find Doc And Set Data Code Example – java

Create Copy Of Array From Another Array Code Example – java

Copyright © Code Fetcher 2020

 

 

Published

Leave a comment

Your email address will not be published. Required fields are marked *