about | help | code help+videos | done | prefs |
Write a method that returns the first 'howMany' characters in string 'str1'. If the string is not long enough to have 'howMany' characters, return "string not long enough" instead. Look at the test data for examples. test2021_10_07_APSLHL_firstX("Plot twist!", 4) → "Plot" test2021_10_07_APSLHL_firstX("this is a very, very, very long string. It is so long you would think that almost any number would be small enough, but that is not true. All it takes is a bigger number than the length of this string.", 52) → "this is a very, very, very long string. It is so lon" test2021_10_07_APSLHL_firstX("this is a very, very, very long string. It is so long you would think that almost any number would be small enough, but that is not true. All it takes is a bigger number than the length of this string.", 542) → "string not long enough" ...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