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

 

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

Write a method that returns a string based on the 'orig' string, but with the back part of the string moved to the front and with 'add' inserted in the middle. The position to use when swapping the front and back of 'orig' is called 'pos'. For example, if 'orig' is "abcdefghij", 'pos' is 3, and 'add' is "-xyz-" you would return "defghij-xyz-abc"


quiz2023_02_28_APP1SLHL_swap("st hereSpring Br", 7, "eak is almo") → "Spring Break is almost here"
quiz2023_02_28_APP1SLHL_swap("I don't like making test data, but I have to do it.", 18, "SWARM") → "g test data, but I have to do it.SWARMI don't like makin"
quiz2023_02_28_APP1SLHL_swap("water", 2, "swim") → "terswimwa"

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

public String quiz2023_02_28_APP1SLHL_swap(String orig, int pos, String add) { }

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