Crystal 11 reports: How to process or trim special characters

In my report on the crystal, I noticed that one of the fields pulled from the table has special characters. More specifically, carriage returns and tabs. Is there a way to remove this, so it does not appear empty in my reports?

Thanks in advance.

+7
crystal-reports
source share
1 answer

This should do it:

stringvar output := {TABLE_NAME.FIELD_NAME}; output := Trim(output); //get rid of leading & trailing spaces output := Replace(output,Chr(13),''); //get rid of line feed character output := Replace(output,Chr(10),''); //get rid of carriage return character //add any other special characters you want to strip out. 

If you have many characters that can be crossed out, you can use this slightly more convenient approach. Just add all the characters you want to cut to []:

 stringvar input := {DROPME.TEST_FIELD}; stringvar output := ''; numbervar i; input := Trim(input); for i := 1 to Length(input) Step 1 do if not(input[i] in [Chr(13),Chr(10)]) then output := output + input[i]; output 
+10
source share

All Articles