I remove the caracters !"#$%&()*+,-./:;<=>?@[]^_`{|}~
but I also want to remove the ’ character but when I add it to the function’s parameters it is interpreted as a closing quote.
I tried the escape character \ like in Linux or mysql or javascript but it doesn’t actually work in NAV
Is there any escape characters in NAV? or is there a better way to accomplish that purpose?
So, to answer your direct question, if you want to include the apostrophe as a literal within the WHICH expression (or any literal text string for that matter), just precede it with another apostrophe, like this ‘!@#$%’’%^&*’. So, in the case where you only wanted to include the apostrophe as the character to delete, you would enter 4 apostrophes for the WHICH expression. The first and last would define the string expression, the second would tell the executable not to interpret the next character, and the third would be your literal.
So that answers you specific question.
Now, there are other ways to solve this problem. One way would be to build a text constant that includes all of the characters you want to strip out of the source string. The, when you make the call to DELCHR, you’d substitute the literal WHICH expression with the name of the text constant. Something like this … delchr(sourcestring, ‘=’, TextInvalidChars)
Then, too, if the list of valid characters is shorter than the list of invalid characters, or if, rather than wanting to delete specific characters, you only want specific characters to remain, then you might make a text constant based on all of the valid characters. Then you’d make a command to capture the output of the delchr command that strips all of the valid characters out of the source string, and then uses that return value as the WHICH expression of a second delchr command, something like this … delchr(sourcestring, ‘=’, delchr(sourcestring, ‘=’, TextValidChars))