about | help | code help+videos | done | prefs |
Write a method that returns a string based on 'str' but with the first and last 'remove' number of characters removed from the string. For example, if 'str' is "ABCDEFGH" and 'remove' is 2, you would return "CDEF". As a precondition, you may assume that 'remove' is non-negative. Remove could be so big that the entire string is removed. In that case return an empty string. For example, it 'str' is "Yoda" and remove is 20, you would return "". Look at the test data for examples. test2024_02_08_APP1SLHL_middle("Testing", 2) → "sti" test2024_02_08_APP1SLHL_middle("remove the same number of characters from the front and back of the string", 14) → "e number of characters from the front and back" test2024_02_08_APP1SLHL_middle("When 'remove' is a big enough number, you will return an empty string.", 44) → "" ...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: 220
Copyright Nick Parlante 2017 - privacy