5 kyu
String incrementer
22,502 of 51,741parceval
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 | 131703 |
Total Skips | 23597 |
Total Code Submissions | 447379 |
Total Times Completed | 51741 |
JavaScript Completions | 22502 |
Python Completions | 22471 |
Ruby Completions | 1781 |
Kotlin Completions | 871 |
COBOL Completions | 7 |
Factor Completions | 10 |
Rust Completions | 391 |
C Completions | 452 |
Java Completions | 1907 |
C++ Completions | 1683 |
Scala Completions | 100 |
Total Stars | 3106 |
% of votes with a positive feedback rating | 90% of 4743 |
Total "Very Satisfied" Votes | 3914 |
Total "Somewhat Satisfied" Votes | 694 |
Total "Not Satisfied" Votes | 135 |
Total Rank Assessments | 115 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 1 kyu |
Lowest Assessed Rank | 7 kyu |