Encog.MathUtil.Convert.String2Int C# (CSharp) Method

String2Int() public static method

Convert a string to an int. Just make the number a zero if the string is invalid.
public static String2Int ( String str ) : int
str String The string.
return int
        public static int String2Int(String str)
        {
            int result = 0;
            try
            {
                if (str != null)
                {
                    result = int.Parse(str);
                }
            }
            catch (Exception)
            {
                result = 0;
            }
            return result;
        }
    }