about | help | code help+videos | done | prefs |
Write a method that has two input parameters 'str' and 'skip'. The 'str' parameter will contain any string. The 'skip' parameter will be an integer greater than 1. Return a new string based on 'str' but with every 'skip' character skipped. For example, if 'str' is "Hello there!" and 'skip' is 3, you would return "Helothre" because you would skip every 3rd character. Note that 'str' could be any length and 'skip' can be any integer greater than 1. If 'skip' is greater than the length of 'str' you would just return the entire 'str' string, since no characters would be skipped. Restrictions: The ONLY String methods you are allowed to use are: .length, .substring, .charAt, .equals, .compareTo test2024_10_31_APP1SLHL_skipLetter("Home is behind, the world ahead, and there are many paths to tread through shadows to the edge of night, until the stars are all alight.", 10) → "Home is bhind, theworld ahed, and thre are may paths t tread though shadws to theedge of nght, unti the star are all light." test2024_10_31_APP1SLHL_skipLetter("It's a dangerous business, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to.", 2) → "I' agru uies on u ordo.Yuse notera,adi o o' epyu et hr' okoigweeyumgtb wp f o" test2024_10_31_APP1SLHL_skipLetter("It's the job that's never started as takes longest to finish.", 5) → "It'sthe ob tat'sneve stated s taes lnges to inis." ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 250
Copyright Nick Parlante 2017 - privacy