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

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

import java.util.List;

/**
 * @name
 * @description
 */
public class SplitOriginalAndTranslationHandler implements IProcessData {
    public SplitOriginalAndTranslationHandler() {
    }

    @Override
    public Object processData(Object data, Object splitSymbol) {
        List<String> splitList = StringUtils.changeStringToString(splitSymbol.toString(), ",");
        if (splitList.get(0).equals("1")) {
            return StringUtils.changeStringToString(data.toString(), splitList.get(1)).get(0);
        } else if (splitList.get(0).equals("2")) {
            if (StringUtils.changeStringToString(data.toString(), splitList.get(1)).size() == 2) {
                return StringUtils.changeStringToString(data.toString(), splitList.get(1)).get(1);
            }
        }
        return null;
    }
}
