1
I need to capture the correct amount of bank notes through the digit line, but I’m not getting.
Here’s how I do:
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 correctly capture the left part of the comma independent of number of houses?