如何读取跳过读取具有字符“01”的行的行?和“25”

发布于 2024-11-24 17:39:09 字数 788 浏览 4 评论 0原文

示例:

FSA claim 'TO' date of service is 20111201 and the selection date is 20110627
FSA claim 'TO' date of service is 20110702 and the selection date is 20110627
FSA claim 'TO' date of service is 20110725 and the selection date is 20110627

我的代码是:

else if (line.ToUpper().Contains(" FSA CLAIM 'TO' DATE"))
{
    if (!(line.Substring(34, 2).Trim() != "01" & (!(line.Substring(34, 2).Trim() != "25"))))
    {
        //MyClaimNumber = MyHoldline.Substring(25, 12);
        outputFSAClaimtodate.WriteLine(MyHoldline);
        outputFSAClaimtodate.WriteLine(line);

它仍然读取包含它们的行。

我的目标应该是这样的:

FSA claim 'TO' date of service is 20110702 and the selection date is 20110627

请帮忙!!!

Example:

FSA claim 'TO' date of service is 20111201 and the selection date is 20110627
FSA claim 'TO' date of service is 20110702 and the selection date is 20110627
FSA claim 'TO' date of service is 20110725 and the selection date is 20110627

my code is:

else if (line.ToUpper().Contains(" FSA CLAIM 'TO' DATE"))
{
    if (!(line.Substring(34, 2).Trim() != "01" & (!(line.Substring(34, 2).Trim() != "25"))))
    {
        //MyClaimNumber = MyHoldline.Substring(25, 12);
        outputFSAClaimtodate.WriteLine(MyHoldline);
        outputFSAClaimtodate.WriteLine(line);

it still read those line containing them.

My target out should be like this:

FSA claim 'TO' date of service is 20110702 and the selection date is 20110627

Please help!!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤千羽 2024-12-01 17:39:09

这种情况:

!(line.Substring(34, 2).Trim() != "01" & (!(line.Substring(34, 2).Trim() != "25")))

令人困惑。例如,它有:

!(line.Substring(34, 2).Trim() != "25")

或“不(不等于)”,这与“等于”相同:

(line.Substring(34, 2).Trim() == "25")

如果你的意思是“既不是X也不是Y”,那就是“(不是X)和(不是Y)”:

if (line.Substring(34, 2).Trim() != "01" && line.Substring(34, 2).Trim() != "25")

This condition:

!(line.Substring(34, 2).Trim() != "01" & (!(line.Substring(34, 2).Trim() != "25")))

is confusing. It has, for example:

!(line.Substring(34, 2).Trim() != "25")

or "not (not equals)", which is the same as "equals":

(line.Substring(34, 2).Trim() == "25")

If you mean "neither X nor Y", that's "(not X) and (not Y)":

if (line.Substring(34, 2).Trim() != "01" && line.Substring(34, 2).Trim() != "25")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文