Avoid Non Printing Characters

sampath

New Member
How to avoid non printing character when its in middle of a text

ex: This is a Sample <non printing characters> Text.

When printing above example
This is a Sample
Text.

I want to print above example like this This is a Sample Text. (avoiding go to next line)
view
view

Progress 9.1D Windows
 

Osborne

Active Member
One way is to read each character and replace the non printing ones. In this example the return character is replaced with a space:
Code:
DEFINE VARIABLE vChar AS CHARACTER NO-UNDO.
DEFINE VARIABLE vCount AS INTEGER NO-UNDO.
DEFINE VARIABLE vPrintText AS CHARACTER NO-UNDO.
DEFINE VARIABLE vText AS CHARACTER NO-UNDO.

vText = "This is a Sample" + CHR(13) + "Text".

DO vCount = 1 TO LENGTH(vText):
   vChar = SUBSTR(vText,vCount,1).
   IF ASC(vChar) = 13 THEN
   /* or IF KEYLABEL(ASC(vChar)) = "ENTER" THEN */
   /* or IF KEYFUNCTION(ASC(vChar)) = "RETURN" THEN */
      vChar = " ".
   vPrintText = vPrintText + vChar.
END.

MESSAGE vPrintText VIEW-AS ALERT-BOX INFORMATION.
 
Top