5 kyu
String incrementer
22,671 of 52,254parceval
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 | 132783 |
Total Skips | 23715 |
Total Code Submissions | 450046 |
Total Times Completed | 52254 |
JavaScript Completions | 22671 |
Python Completions | 22686 |
Ruby Completions | 1787 |
Kotlin Completions | 883 |
COBOL Completions | 8 |
Factor Completions | 11 |
Rust Completions | 407 |
C Completions | 464 |
Java Completions | 1961 |
C++ Completions | 1731 |
Scala Completions | 103 |
Total Stars | 3122 |
% of votes with a positive feedback rating | 90% of 4764 |
Total "Very Satisfied" Votes | 3931 |
Total "Somewhat Satisfied" Votes | 696 |
Total "Not Satisfied" Votes | 137 |
Total Rank Assessments | 115 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 1 kyu |
Lowest Assessed Rank | 7 kyu |