Write a static method that will receive two Strings, a needle and a haystack. The method should return true
if the needle is found surrounded by quotation marks. Also, there must either be a space next to the quotes or a String boundary.
Preconditions:
null
and will be length 1 or greater.null
.Examples:
isQuoted(n, text)
returns the following assuming n is bark
....
true
when text is Don't you "bark" at me!
true
when text is His "bark" is worse than his bite.
false
when text is His bark is worse than his bite.
false
when text is bark
false
when text is b
true
when text is "bark"
true
when text is "bark" at the moon
true
when text is the night is long and the path is "bark"
false
when text is dog:"bark" :: cat:"hiss"
©2003–2016 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.