package com.rdiot.yx485.util;

import android.text.TextUtils;

/**
 * @author admin
 * @date 2021/1/7
 */
public class StringUtils {

    public static String checkEmpty(String string) {
        if (TextUtils.isEmpty(string)) {
            return "";
        }
        return string;
    }

    public static String checkZero(String string) {
        if (TextUtils.isEmpty(string)) {
            return "";
        }

        String[] strings = string.split("\\.");
        if (strings.length > 1 && Integer.parseInt(strings[1]) == 0) {
            return String.valueOf(strings[0]);
        }

        return string;
    }
}
