题解 | #字符串分隔#

字符串分隔

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

const str = readline();

function splitFun(str){
    let length = str.length;
    let a = '';
    if(str.length === 0){
        return;
    } 
    while(str.length !== 0){
        if(str.length % 8 !== 0){
            str = str + '0'
        } else {
            console.log(str.substring(0, 8)) 
            str = str.substring(8)
        }
    }  
}

splitFun(str)
全部评论

相关推荐

09-02 11:14
已编辑
四川大学 Java
吴offer选手:这种面试是最烦的,学不到东西,然后还被挂的莫名其妙。之前看到一种说法是面试官如果不想要你了,就会问一些很简单的问题,防止你举报他
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
09-11 13:00
投递长江存储等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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