Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import java.util.Scanner; // this is so we can get input from the user
  2.  
  3. public class SearchForThings {
  4.  
  5.  
  6. /* This is a  method that returns an integer value (the location of the string you're searching for, and takes two string inputs, the first being the string in which you will search, and the second being what you're looking for */
  7.  
  8. public int search(String data, String search) {
  9.  
  10. return data.indexOf(search); // returns 5, the index of the first character in "is"
  11.  
  12. }
  13.  
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement