Beispiel #1
0
 /// <summary>
 /// 转换成Int,否则为0
 /// </summary>
 /// <param name="argObj"></param>
 /// <returns></returns>
 public static int AsInt(this string argObj)
 {
     if (NumberUtility.IsIntNumber(argObj))
     {
         return(int.Parse(argObj.ToString()));
     }
     return(0);
 }
Beispiel #2
0
        /// <summary>
        /// 转换成Long,否则为0
        /// </summary>
        /// <param name="argValue"></param>
        /// <returns></returns>
        public static long AsLong(this string argValue)
        {
            long vResult = 0;

            if (NumberUtility.IsIntNumber(argValue))
            {
                vResult = long.Parse(argValue);
            }
            return(vResult);
        }