Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion kata/7-kyu/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
- [Overflowing with joy](overflowing-with-joy "55186c0f4149dd08a7000006")
- [Page replacement algorithms: FIFO](page-replacement-algorithms-fifo "62d34faad32b8c002a17d6d9")
- [Palindrome chain length](palindrome-chain-length "525f039017c7cd0e1a000a26")
- [Pandemia 🌡️](pandemia "# [Pandemia 🌡5e2596a9ad937f002e510435")
- [Pandemia 🌡️](pandemia "5e2596a9ad937f002e510435")
- [Parallel resistors](parallel-resistors "5723b111101f5f905f0000a5")
- [Partial Word Searching](partial-word-searching "54b81566cd7f51408300022d")
- [Parts of a list](parts-of-a-list "56f3a1e899b386da78000732")
Expand Down Expand Up @@ -513,6 +513,7 @@
- [String prefix and suffix](string-prefix-and-suffix "5ce969ab07d4b7002dcaa7a1")
- [Strong Number (Special Numbers Series #2)](strong-number-special-numbers-series-number-2 "5a4d303f880385399b000001")
- [Subcuboids](subcuboids "5b9e29dc1d5ed219910000a7")
- [Substituting Variables Into Strings: Padded Numbers](substituting-variables-into-strings-padded-numbers "51c89385ee245d7ddf000001")
- [Substring fun](substring-fun "565b112d09c1adfdd500019c")
- [Suitcase packing](suitcase-packing "5c556845d7e0334c74698706")
- [Sum a list but ignore any duplicates](sum-a-list-but-ignore-any-duplicates "5993fb6c4f5d9f770c0000f2")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# [Substituting Variables Into Strings: Padded Numbers](https://www.codewars.com/kata/substituting-variables-into-strings-padded-numbers "https://www.codewars.com/kata/51c89385ee245d7ddf000001")

Complete the solution so that it returns a formatted string. The return value should equal "Value is VALUE" where value is a 5 digit padded
number.

Example:

```
solution(5); // should return "Value is 00005"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
interface Kata {
static String solution(int value) {
return String.format("Value is %05d", value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

class Tests {
@ParameterizedTest
@CsvSource(textBlock = """
0, Value is 00000
5, Value is 00005
109, Value is 00109
1204, Value is 01204
""")
void sample(int n, String expected) {
assertEquals(expected, Kata.solution(n));
}
}