Exemple #1
0
        public static int ToInt(string str)
        {
            var iValue = 0;

            try
            {
                var isHaveW = str.Contains("万");
                str = StrHelper.GetStrByRegx(str, @"(-?\d+)(\.\d+)?");//"^(-?/d+)(/./d+)?$"  //浮点数
                var i = StrHelper.ToDouble(str);
                if (isHaveW)
                {
                    iValue = Convert.ToInt32(i * 10000);
                }
                else
                {
                    iValue = StrHelper.ToInt32(i.ToString());
                }
            }
            catch
            {
            }
            return(iValue);
        }