2
I have the following return: 7100-1156
As a result I would like to always extract the second part of the string: 1156
.
The example code does this but the problem is when the value of the first part of the string has less or more characters.
The idea is to extract everything you have after the -
in any situation.
var codigo = "7100-1156";
var resultado = codigo.substring(5, 15);
console.log(resultado);
Please what would be the other examples, why give a
split
will not solve in all cases?– novic