小编She*_*boy的帖子

C#float.Parse字符串

我是C#的新手,需要从文件中读取float(x, y, z).看起来像:

0 -0.01 -0.002

0.000833333333333 -0.01 -0.002

如果我尝试

float number = float.Parse("0,54"); // it works well, but
float number = float.Parse("0.54"); // gains exepction.
Run Code Online (Sandbox Code Playgroud)

我从每行读取值的代码(可能会被窃听):

int begin = 0;
int end = 0;
for (int i = 0; i < tempLine.Length; i++)
{
    if (Char.IsWhiteSpace(tempLine.ElementAt(i)))
    {
        end = i;
        float value = float.Parse(tempLine.Substring(begin, end));
        begin = end;
        System.Console.WriteLine(value);
    }
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?

.net c# string substring type-conversion

13
推荐指数
2
解决办法
4万
查看次数

检查电子邮件是否已发送 -- Delphi Indy10

我的应用程序将电子邮件发送到给定的地址,这工作正常。问题是,这些电子邮件地址之一可能不正确并且不存在。我正在使用 Delphi 2009 和 Indy10 组件(TIdSMTP 和 TIdMessage)。

Try
  Try
    SMTP.Connect;
    SMTP.Send(MailMessage);
    resultTmp := ?????
 Except
   on E : Exception do begin
     ShowMessage(E.Message);
   end;
 End;
Finally
  if SMTP.Connected then begin
    SMTP.Disconnect;
  end;
End
Run Code Online (Sandbox Code Playgroud)

如何检查电子邮件是否已发送?在我的测试 Gmail 帐户中,如果我尝试将电子邮件发送到错误的地址,我会收到类似“地址未找到”的电子邮件。

谢谢

delphi email indy delphi-2009 indy10

2
推荐指数
1
解决办法
1568
查看次数

标签 统计

.net ×1

c# ×1

delphi ×1

delphi-2009 ×1

email ×1

indy ×1

indy10 ×1

string ×1

substring ×1

type-conversion ×1