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

时间:2011-07-19 17:37:28

标签: substring

示例:

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

请帮助!!!

1 个答案:

答案 0 :(得分:0)

这个条件:

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

令人困惑。它有,例如:

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

或" not(not equalals)",与&#34相同;等于":

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

如果你的意思是" X和Y",那"(不是X)和(不是Y)":

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