10 Replies Latest reply on Jan 25, 2017 9:23 AM by philmodjunk

    Filtering out ASCII/Unicode NULL characters

    SeanRiser

      Title

      Filtering out ASCII/Unicode NULL characters

      Post

      Whenever our users copy anything from the command prompt, the command prompt sends a string containing the selected area, a null character, and a newline character. The newline character isn't hard to remove, but I tried to filter out the null character with a custom function like:

      Substitute(text; Char(0); "")

      And nothing happens. I'm certain that the character is the null character, since I've examined the clipboard contents in another programming language (that doesn't use null-terminated strings) and saw the character.

      Any ideas on how to filter this out?

      EDIT: I should probably mention I'm using FileMaker Pro Advanced 11.0v2 on Windows.

      Second EDIT: Working code for the impatient:

      Case (  Length(text) = 0; "";
                  Code(Left(text; 1)) = 0; "" & FilterNull(Right(text; Length(text)-1));
                  Left(text; 1) & FilterNull(Right(text; Length(text)-1))
      )