id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > smaugChompsAdvanced1
prev  |  next  |  chance

Write a method that returns a string with all of the 'replace' characters replaced with 'replaceWith', UNLESS 'avoid' appears directly in front of, or after the character. Note that there are three strings, 'replace', 'avoid', and 'replaceWith' which you may assume contain exactly one character each as a precondition. The String 'orig' can be any length.


smaugChompsAdvanced1("all apes are eating apples", "a", "t", "Z") → "Zll Zpes Zre eating Zpples"
smaugChompsAdvanced1("This is it if you itch", "i", " ", "-") → "Th-s is it if you itch"
smaugChompsAdvanced1("Testing is so fun", "n", "g", "L") → "Testing is so fuL"

...Save, Compile, Run (ctrl-enter)

public String smaugChompsAdvanced1(String orig, String replace, String avoid, String replaceWith) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 290

Copyright Nick Parlante 2017 - privacy