Remove Null Characters

sabzamsabzam Member Posts: 1,149
Hi All,

I am exporting Data to a text file.

The problem is that at the very end of each line before the return for a fresh line a null character is being placed which when opened by notepad shows as a small square box. This is messing up with another system since it is not excepting the file due to this null value.

Is there a way how I can remove this Null Character please

Thanks and Regards

Comments

  • kash387kash387 Member Posts: 111
    I think 10 is the ascii value of null.
    rest depends on you n your prob.
    Thanks,

    Kashyap
  • sabzamsabzam Member Posts: 1,149
    Hi,

    Thanks for your reply,

    Yes, the problem is that the null character is appearing at the end of each line just before the CR/LF. I want to keep the CR/LF but that null value just before is not allowing the other system to upload the file as it is being corrupt

    example

    [John, Smith][NullValue][CR/LF]

    I want to remove the [NullValue]. I have already tried using the String Truncate but to no success

    Regards
  • kash387kash387 Member Posts: 111
    I think you should write two lines for that.
    One line is to store the characters before null value, and the second line is to start from null value.

    I have written a code one year before so I dont remember yet.... bt you can use if cond or for loop to skip the line when you reach at 10.
    Thanks,

    Kashyap
  • matttraxmatttrax Member Posts: 2,309
    Here's a utility function I wrote a while back. Could probably be done better, but it does the job.
    ch is a local Char variable.
    DelBadChars(String : Text[1024]) : Text[1024]
    
    FOR ch := 0 TO 31 DO BEGIN
      String := DELCHR(String, '=', FORMAT(ch));
    END;
    FOR ch := 127 TO 255 DO BEGIN
      String := DELCHR(String, '=', FORMAT(ch));
    END;
    
    EXIT(String);
    
Sign In or Register to comment.