mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2024-11-09 22:08:58 +01:00
.. | ||
solutions | ||
test | ||
README.md |
left-pad
Created by @theoludwig on 21 May 2023.
Instructions
Create a function that pads the current string with another string (multiple times, if needed) until the resulting string reaches the given length. The padding is applied from the start (left) of the current string.
Inspired from left-pad (JavaScript npm package).
Input
- Line 1: The current string
- Line 2: The length of the resulting string
- Line 3: The string to pad the current string with
Examples
See the test
folder for examples of input/output.
Example 1
Input
foo
12
-
Output
---------foo