package cn.cslg.pas.common.utils.handler;

import cn.cslg.pas.common.utils.StringUtils;

import java.util.Arrays;
import java.util.stream.Collectors;

public class SplitBySerialNumberAndRemoveLineFeedHandler implements IProcessData {
    public SplitBySerialNumberAndRemoveLineFeedHandler() {
    }

    @Override
    public Object processData(Object data, Object splitSymbol) {
        return Arrays.stream(data.toString().replaceAll("\n", "").split(splitSymbol.toString()))
                .filter(StringUtils::isNotEmpty)
                .collect(Collectors.toList());
    }
}
