All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hiczp.bilibili.api.live.bulletScreen.BulletScreenHelper Maven / Gradle / Ivy

There is a newer version: 0.2.0
Show newest version
package com.hiczp.bilibili.api.live.bulletScreen;

import javax.annotation.Nonnull;

public class BulletScreenHelper {
    public static String[] splitMessageByFixedLength(@Nonnull String message, int lengthLimit) {
        int count = message.length() / lengthLimit;
        if (message.length() % lengthLimit != 0) {
            count++;
        }
        String[] messages = new String[count];
        for (int i = 0; i < count; i++) {
            messages[i] = message.substring(i * lengthLimit, i != count - 1 ? (i + 1) * lengthLimit : message.length());
        }
        return messages;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy