/// <summary>
 /// string型转换为bool型
 /// </summary>
 /// <param name="strValue">要转换的字符串</param>
 /// <param name="defValue">缺省值</param>
 /// <returns>转换后的bool类型结果</returns>
 public static bool StrToBool(object expression, bool defValue)
 {
     if (expression != null)
     {
         return(TypeConvertUtils.StrToBool(expression, defValue));
     }
     return(defValue);
 }
        /// <summary>
        /// string型转换为float型
        /// </summary>
        /// <param name="strValue">要转换的字符串</param>
        /// <returns>转换后的int类型结果</returns>
        public static float StrToFloat(string strValue)
        {
            if ((string.IsNullOrEmpty(strValue)))
            {
                return(0);
            }

            return(TypeConvertUtils.StrToFloat(strValue.ToString(), 0));
        }
        /// <summary>
        /// string型转换为float型
        /// </summary>
        /// <param name="strValue">要转换的字符串</param>
        /// <param name="defValue">缺省值</param>
        /// <returns>转换后的int类型结果</returns>
        public static float ObjectToFloat(object strValue, float defValue)
        {
            if ((strValue == null))
            {
                return(defValue);
            }

            return(TypeConvertUtils.StrToFloat(strValue.ToString(), defValue));
        }
        /// <summary>
        /// 将对象转换为Int32类型
        /// </summary>
        /// <param name="strValue">要转换的字符串</param>
        /// <param name="defValue">缺省值</param>
        /// <returns>转换后的int类型结果</returns>
        public static int ObjectToInt(object expression, int defValue)
        {
            if (expression != null)
            {
                return(TypeConvertUtils.StrToInt(expression.ToString(), defValue));
            }

            return(defValue);
        }
 /// <summary>
 /// 字符串转成整型数组
 /// </summary>
 /// <param name="idList">要转换的字符串</param>
 /// <param name="defValue">缺省值</param>
 /// <returns>转换后的int类型结果</returns>
 public static int[] StringToIntArray(string idList, int defValue)
 {
     if (string.IsNullOrEmpty(idList))
     {
         return(null);
     }
     string[] strArr = StringUtils.SplitString(idList, ",");
     int[]    intArr = new int[strArr.Length];
     for (int i = 0; i < strArr.Length; i++)
     {
         intArr[i] = TypeConvertUtils.StrToInt(strArr[i], defValue);
     }
     return(intArr);
 }
 /// <summary>
 /// 将对象转换为Int32类型
 /// </summary>
 /// <param name="expression">要转换的字符串</param>
 /// <param name="defValue">缺省值</param>
 /// <returns>转换后的int类型结果</returns>
 public static int StrToInt(object expression, int defValue)
 {
     return(TypeConvertUtils.ObjectToInt(expression, defValue));
 }
 /// <summary>
 /// 将对象转换为Int32类型,转换失败返回0
 /// </summary>
 /// <param name="str">要转换的字符串</param>
 /// <returns>转换后的int类型结果</returns>
 public static int StrToInt(string str)
 {
     return(TypeConvertUtils.StrToInt(str, 0));
 }
 /// <summary>
 /// Object型转换为float型
 /// </summary>
 /// <param name="strValue">要转换的字符串</param>
 /// <param name="defValue">缺省值</param>
 /// <returns>转换后的int类型结果</returns>
 public static float StrToFloat(object strValue, float defValue)
 {
     return(TypeConvertUtils.StrToFloat(strValue, defValue));
 }