X1518: String in the middle?

Write a method stringMiddle that returns true if the fullstring argument contains the string stored in substring. It should return false otherwise. The substring cannot start at position 0 in the fullstring.

Note that you are NOT allowed to use any of startsWith(), endsWith() nor contains() but you may consult the String documentation for other methods to use.

Examples:

stringMiddle("hello", "lo") -> true
stringMiddle("hello", "el") -> true
stringMiddle("hello", "hello") -> false
stringMiddle("hola", "hol") -> false
stringMiddle("hello", "world") -> false

Your Answer:

Feedback

Your feedback will appear here when you check your answer.