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

 

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

For this problem, the only string methods you are allowed to use are .length, .substring, .charAt, and .equals. You are not required to use all of those methods. You can, as always, also use string concatenation and assignment. Write a method that accepts a string parameter and a character parameter. Return a new string that is identical to the string parameter except that all occurrences of the character have been replaced with a '-'. For example, if the string parameter is "this is a test" and the character to replace is 'i', you will return "th-s -s a test". Look at the test data for further examples.


ddd1RemoveLetter("The fox jumped", "i") → "The fox jumped"
ddd1RemoveLetter("this is a test", "i") → "th-s -s a test"
ddd1RemoveLetter("abcdefg", "c") → "ab-defg"

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

public String ddd1RemoveLetter(String str, char ltr) { }

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: 280

Copyright Nick Parlante 2017 - privacy