I need to capture the correct amount of bank tickets through the digitable line, but I can not.
Here's how:
var linha = "34191.75009 01544.841545 78554.760005 4 25230000093423";
var valor = linha.substring(45,54).replace(/^0+/, ''); // Retira todos os zeros à esquerda
var valor_final = valor.substring(0,3) + "," + valor.substring(4,5); // 934,23
So far so good, but if the value is less than 100
or greater than 999
, how to capture correctly?
Is there any other way to properly capture the left-hand portion of the house-independent comma?