JavaScript/5kyu/String_incrementer.js
// Attention: If the number has leading zeros the amount of digits should be considered.
If the number has leading zeros the amount of digits should be considered.
If the number has leading zeros the amount of digits should be considered .
function incrementString (strng) {
  let num = strng.replace(/[^0-9\.]+/g, '')
  let alpha = strng.replace(/[^a-zA-Z\.]+/g, '')
  if (num === '') {
    return alpha + '1';
  } else {
    let nextNum = (parseInt(num) + 1).toString()
    return alpha + pad(nextNum, num.length)  
  }
}
function incrementString ( strng ) { let num = strng . replace ( / [^0-9\.]+ / g , '' ) let alpha = strng . replace ( / [^a-zA-Z\.]+ / g , '' ) if ( num === '' ) { return alpha + '1' ; } else { let nextNum = ( parseInt ( num ) + 1 ) . toString ( ) return alpha + pad ( nextNum , num . length ) } }
Attention: If the number has leading zeros the amount of digits should be considered.
Attention : If the number has leading zeros the amount of digits should be considered .