An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Hi @Jonathan ,
From the screenshot, it looks like your code is extracting a field from a string, writing it to a file, and then comparing it with a previous value (Unb_last_fie).
For example, suppose the input is:
- Line0 = "UNZ+1+ABC123'"
- Unb_last_fie = "XYZ789"
If the code successfully extracts ABC123 as Unz_fie, it should write that value to the file. Since XYZ789 and ABC123 are different, the subsequent validation block should also execute.
Based on this behavior, here are a few things you can check:
- First, check the values of
Pos0,Pos1, andPos2to make sure the delimiters are found at the expected positions. IfIndexOf()returns -1, the subsequent Substring() operation may fail or produce an unexpected result. - Also, keep in mind that the second block only runs when both
Unb_last_fieandUnz_fie are non-empty and their values are different. Otherwise, that block will be skipped. - Finally, check the value of
allowappend, as it determines whetherStreamWriterappends content to the existing file or overwrites it.
You can try checking these values in the debugger to see where the actual behavior differs from what you expect.
If the issue persists, feel free to upload a minimal reproducible version of your project to a public GitHub repository and share the link here. Please remove any sensitive information before uploading, and include a brief description of what the code is intended to do, along with the expected and actual results. This will help me take a closer look at the issue.
I hope these suggestions help you narrow down the issue. If you find the information helpful, I'd appreciate it if you could refer to the guide for your confirmation.
Thank you.