Here is the fastest way I have found to eliminate "bad chars" in
"string"

 bad.chars = ""
 for n = 1 to 31
   bad.chars := char(n)
 next n
 for n = 128 to 250
   bad.chars := char(n)
 next n
 convert bad.chars to "" in string

/Scott Ballinger
Pareto Corporation
Edmonds WA USA
206 713 6006


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Baker Hughes
Sent: Tuesday, December 13, 2005 8:32 AM
To: [email protected]
Subject: RE: [U2] records with unprintable characters

Carl,

We faced this recently with data coming from our E-commerce portal,
here's a function we put in our Standard.Variables Include, so we can do
this from any program:

 FUNCTION CLEAN.STRING(STRING.IN)
      RESULT = ''
      LEN.STR = LEN(STRING.IN)

       FOR STR.POS = 1 TO LEN.STR

          STR.CHAR = STRING.IN[STR.POS,1]
          DEC.VAL = SEQ(STR.CHAR)

         BEGIN CASE
             CASE DEC.VAL LT 32
                NULL
             CASE DEC.VAL LT 126
                RESULT := STR.CHAR
             CASE 1
                NULL
          END CASE

       NEXT STR.POS
       RETURN(RESULT)

usage - after we receive input from screen, or data load:
RESP = CLEAN.STRING(RESP)

BakerDOTHughes
ATMouserDOTCom


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Carl Sadlier
Sent: Tuesday, December 13, 2005 9:18 AM
To: [email protected]
Subject: [U2] records with unprintable characters


Does anyone have a program or suggestions on how to clean up a file that
has control characters and unprintable characters that are not
Subvalue,Value or Field markers?

Thanks,

Carl
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to