• Post Reply Bookmark Topic Watch Topic
  • New Topic

Checks whether the first string is a substring of the second  RSS feed

 
gabriel terry
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Check substrings) You can check whether a string is a substring of another string by using the indexOf method in the String class. Write your own method for
this function. Write a program that prompts the user to enter two strings, and checks whether the first string is a substring of the second.



I am looking for ideas to accomplish this program. I have no idea what the function should return

 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well...if I was writing a method that would determine one of two thing - like "Is a substring" or "Is not a substring", there is a built-in type that has exactly two values. i'd probably use that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!