Jan Return 2
This review assumes that you have done CodingBat Logic-1 and String-2.
-
(
dollarOut
) Return a version of the given string where every appearance of$
in the original string is removed, along with two characters to the left and one character to the right of it. If there are not that many characters, remove what is available.public String dollarOut(String str) {...} dollarOut("spend$now") => "speow" dollarOut("some$dollar$xy") => "soolly" dollarOut("A$lan") => "an" dollarOut("lo$") => ""
-
(
decString
) Given three strings x y z, return true if each one is shorter than the previous one. Unless sameSize is true, in which case also return true if the previous string is the same size.public boolean decString(String x, String y, String z, boolean sameSize) {...} decString("aaaaa","bbb","c", false) => true decString("apple","cart","horse",true) => false decString("banana","mango","orang",true) => true decString("plum","watermelon","yam",true) => false