Skip to content

Commit ab6693d

Browse files
authored
纠正 0093.复制IP地址 JavaScript 版本代码
String 实例 substr 方法已弃用,请使用 slice 方法
1 parent e07a3ca commit ab6693d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

problems/0093.复原IP地址.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ var restoreIpAddresses = function(s) {
444444
return;
445445
}
446446
for(let j = i; j < s.length; j++) {
447-
const str = s.substr(i, j - i + 1);
447+
const str = s.slice(i, j + 1);
448448
if(str.length > 3 || +str > 255) break;
449449
if(str.length > 1 && str[0] === "0") break;
450450
path.push(str);

0 commit comments

Comments
 (0)