Answers for "retirar os dois ultimos caracteres javascript"

PHP
5

substr() javascript

const str = 'substr';

console.log(str.substr(1, 2)); // (1, 2): ub
console.log(str.substr(1)); // (1): ubstr

/* Percorrendo de trás para frente */
console.log(str.substr(-3, 2)); // (-3, 2): st
console.log(str.substr(-3)); // (-3): str
Posted by: Guest on September-18-2020
0

remover ultimo character string javascript

var texto = $("#input_id").val();
$("#input_id").val(texto.substring(0, texto.length - 1));
Posted by: Guest on September-28-2020

Code answers related to "retirar os dois ultimos caracteres javascript"

Browse Popular Code Answers by Language