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

 

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

Write a method that replaces the beginning of the 'longer' string with the 'shorter' string, while leaving the rest of the string unchanged. Look at the test data for examples! I did this in one line! (Don't make it harder that it is) As preconditions you may assume that 'longer' is longer than 'shorter'.


test2022_01_20_APSLHL_putStr("ab", "A") → "Ab"
test2022_01_20_APSLHL_putStr("Maximum strength", "Minimum") → "Minimum strength"
test2022_01_20_APSLHL_putStr("Boop beep beep tweeeal. Beep boop beep shweee bloop.", "Quiet R2!") → "Quiet R2! beep tweeeal. Beep boop beep shweee bloop."

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

public String test2022_01_20_APSLHL_putStr(String longer, String shorter) { }

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

Copyright Nick Parlante 2017 - privacy