本文整理汇总了C#中KacTalk.ktString.ToDouble方法的典型用法代码示例。如果您正苦于以下问题:C# ktString.ToDouble方法的具体用法?C# ktString.ToDouble怎么用?C# ktString.ToDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KacTalk.ktString
的用法示例。
在下文中一共展示了ktString.ToDouble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ktDelegateFunction
public ktDelegateFunction(ktString Name, ktFunction_Double_Delegate Delegate)
: base(Name, null, null, ktValue.Null)
{
m_Arguments = new ktList();
m_Arguments.Add(new ktValue("D", "double",
kacTalk.Main.GetClass("double"),
true, true));
m_Delegate = delegate(ktList Args)
{
if ((Args == null) || (Args.FirstNode == null) ||
(Args.FirstNode.Value == null))
{
throw new ktError("Didn't get an argument for '" +
Name + "'!", ktERR.MISSING);
}
//ktDebug.Log( "ktDF::DOUBLE(" +Args.FirstNode.Value.ToString() + ")" );
ktString S_In = new ktString(Args.FirstNode.Value.ToString());
double D_In = 0.0;
double D_Out = 0.0;
try
{
if (System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator == ",")
{
S_In.Replace(".", ",", true);
}
D_In = S_In.ToDouble();
}
catch (Exception E)
{
if (E.GetType() == typeof(System.FormatException) && !S_In.IsEmpty())
{
throw new ktError("ktDouble::CreateObject: Cant make '" + S_In + "' into an double", ktERR.WRONGTYPE);
}
}
ktDebug.Log("D_In: " + D_In.ToString());
D_Out = Delegate(D_In);
ktDebug.Log("D_Out: " + D_Out.ToString());
return new ktValue("return", "double",
kacTalk.Main.MakeObjectOf("double", D_Out),
true, true);
};
}