|
using System;
using System.Diagnostics;
//using System.Text;
namespace VVX
{
class DoCvt
{
public static float ToFloat(string sVal, float fDefault, float fMin, float fMax)
{
float fRet = ToFloat(sVal, fDefault);
if (fRet < fMin)
fRet = fMin;
else
if (fRet > fMax)
fRet = fMax;
return fRet;
}
public static float ToFloat(string sVal, float fDefault)
{
float fRet = fDefault;
try
{
if (sVal != null && sVal.Length > 0)
fRet = (float)Convert.ToDouble(sVal);
}
catch (Exception ex)
{
string sMsg = String.Format("'{0}' is not valid", sVal);
Debug.WriteLine(sMsg + "\n" + ex.ToString());
}
return fRet;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.