Advertisement
tolikpunkoff

IsDouble (code fragment)

Aug 9th, 2021
1,525
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         private bool IsDouble(string st)
  2.         {
  3.             st = st.Replace('.', separator);
  4.             st = st.Replace(',', separator);
  5.             NumberFormatInfo format = new NumberFormatInfo();
  6.             format.NumberDecimalSeparator = separator.ToString();
  7.  
  8.             try
  9.             {
  10.                 double d = Convert.ToDouble(st, format);
  11.                 return true;
  12.             }
  13.             catch
  14.             {
  15.                 return false;
  16.             }
  17.         }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement