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

 

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

Write a method that returns the string 'orig' but with each occurrence of the character 'remove' replaced by the character 'replace'. You may NOT use any functional programming or maps. The ONLY string METHODS you are allowed to use are .length, .charAt, .substring, and .equals. You do not need to use all of these.


apr_9_2019_APSLHL_replace("fishy, fishy, fish.", "y", "!") → "fish!, fish!, fish."
apr_9_2019_APSLHL_replace("H", "H", "y") → "y"
apr_9_2019_APSLHL_replace("abcdefggfedcba", "b", "z") → "azcdefggfedcza"

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

public String apr_9_2019_APSLHL_replace(String orig, char remove, char replace) { }

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