Changed calls of the non-standard method String.substr() to substring().

pull/159/head
Project Nayuki 3 years ago
parent 720f62bddb
commit 942f4319a6

@ -227,7 +227,7 @@ namespace app {
if (str.charAt(i) != "%") if (str.charAt(i) != "%")
result.push(str.charCodeAt(i)); result.push(str.charCodeAt(i));
else { else {
result.push(parseInt(str.substr(i + 1, 2), 16)); result.push(parseInt(str.substring(i + 1, i + 3), 16));
i += 2; i += 2;
} }
} }

@ -761,7 +761,7 @@ namespace qrcodegen {
let bb: Array<bit> = [] let bb: Array<bit> = []
for (let i = 0; i < digits.length; ) { // Consume up to 3 digits per iteration for (let i = 0; i < digits.length; ) { // Consume up to 3 digits per iteration
const n: int = Math.min(digits.length - i, 3); const n: int = Math.min(digits.length - i, 3);
appendBits(parseInt(digits.substr(i, n), 10), n * 3 + 1, bb); appendBits(parseInt(digits.substring(i, i + n), 10), n * 3 + 1, bb);
i += n; i += n;
} }
return new QrSegment(QrSegment.Mode.NUMERIC, digits.length, bb); return new QrSegment(QrSegment.Mode.NUMERIC, digits.length, bb);
@ -890,7 +890,7 @@ namespace qrcodegen {
if (str.charAt(i) != "%") if (str.charAt(i) != "%")
result.push(str.charCodeAt(i)); result.push(str.charCodeAt(i));
else { else {
result.push(parseInt(str.substr(i + 1, 2), 16)); result.push(parseInt(str.substring(i + 1, i + 3), 16));
i += 2; i += 2;
} }
} }

Loading…
Cancel
Save