1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-12-08 00:45:29 +01:00
programming-challenges/challenges/left-pad/README.md

36 lines
712 B
Markdown
Raw Normal View History

2023-05-21 12:02:02 +02:00
# left-pad
2023-07-02 17:28:54 +02:00
Created by [@theoludwig](https://github.com/theoludwig) on 21 May 2023.
2023-05-21 12:02:02 +02:00
## 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)](https://www.npmjs.com/package/left-pad).
### 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
```txt
foo
12
-
```
#### Output
```txt
---------foo
```