5 kyu
String incrementer
22,559 of 51,916parceval
Description:
Your job is to write a function which increments a string, to create a new string.
- If the string already ends with a number, the number should be incremented by 1.
- If the string does not end with a number. the number 1 should be appended to the new string.
Examples:
foo -> foo1
foobar23 -> foobar24
foo0042 -> foo0043
foo9 -> foo10
foo099 -> foo100
Attention: If the number has leading zeros the amount of digits should be considered.
Regular Expressions
Strings
Similar Kata:
Stats:
Created | Jan 4, 2015 |
Published | Jan 4, 2015 |
Warriors Trained | 132086 |
Total Skips | 23645 |
Total Code Submissions | 448336 |
Total Times Completed | 51916 |
JavaScript Completions | 22559 |
Python Completions | 22548 |
Ruby Completions | 1783 |
Kotlin Completions | 874 |
COBOL Completions | 8 |
Factor Completions | 11 |
Rust Completions | 398 |
C Completions | 455 |
Java Completions | 1922 |
C++ Completions | 1706 |
Scala Completions | 101 |
Total Stars | 3109 |
% of votes with a positive feedback rating | 90% of 4747 |
Total "Very Satisfied" Votes | 3917 |
Total "Somewhat Satisfied" Votes | 694 |
Total "Not Satisfied" Votes | 136 |
Total Rank Assessments | 115 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 1 kyu |
Lowest Assessed Rank | 7 kyu |