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

 

crehwinkel@frhsd.com apcsa-exam-review-strings2 > replaceLastString
prev  |  next  |  chance

Write a method called replaceLastString, which is given three Strings as input parameters. The method should return the first String which was passed to the method with the last occurrence of the second String replaced in the first String with the third String. For example replaceLastString("Mississippi", "iss", "3") would return "Miss3ippi" and replaceLastString("banana", "a", "0") would return "banan0".


replaceLastString("Mississippi", "iss", "3") → "Miss3ippi"
replaceLastString("Honolulu", "o", "O") → "HonOlulu"
replaceLastString("banana", "a", "ii") → "bananii"

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

public String replaceLastString(String s1, String pat, 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

Copyright Nick Parlante 2017 - privacy