题解 | #字符串分隔#

字符串分隔

http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7

let str;
while(str = readline()){
    getStr(str)
}
function getStr(str){
    let resStr;
    if(str.length == 8){
        resStr = str;
        console.log(resStr)
    }else if(str.length < 8){
        resStr = str.padEnd(8,'0');
        console.log(resStr)
    }else{
        let restStr = str.slice(8);
        resStr = str.slice(0,8);
        console.log(resStr)
        getStr(restStr);
    }
}



全部评论

相关推荐

09-13 17:25
亲切的00后在笔试:我也遇到了,所以我早他一步查看图片
点赞 评论 收藏
分享
评论
2
1
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务