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

 

abraskin@mbusd.org > asterReplace
prev  |  next  |  chance

Given a String, replace each occurrence of "*" in it with the second parameter.


If the second parameter includes an "*" then return "Infinite Loop!" instead.

asterReplace("Th*s *s *t", "i") → "This is it"
asterReplace("Fuzzy Wuzzy was a bear", "X") → "Fuzzy Wuzzy was a bear"
asterReplace("Fuzzy Wuzzy h*d no h*ir", "a") → "Fuzzy Wuzzy had no hair"

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

public String asterReplace(String str, String repl) { }

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: 200 Post-solution available

Copyright Nick Parlante 2017 - privacy