BusinessObjects Board

Replacing non-printable characters with a space

Hi All,

We are getting a long text from SAP ABCD ( non printable char) DEF (non printable char) ---- line 1

GHIJ (non printable char) KLM (non printable char) —line 2

we are having non printable characters through out the long text. the user copy and pasted from an email which is some weird format).

out put required : ABCD [SPACE] DEF [SPACE] —line 1
GHIJ [SPACE] KLM [SPACE].

I have to replace any special character or non-printable character with a space.

I had replaced carriage return and line feed with a space . But I have to handle all non printable characters and special characters and replace with a space. Please suggest. I have to check each and every string and replace with a space if its a special or non-printable character. Please provide if there is any sample code exist.
Thanks
San


kolluri85 :india: (BOB member since 2008-09-10)

See here:

https://bobj-board.org/t/212873


Darth Services :uk: (BOB member since 2007-11-20)

@ Darth Services: Is there any custome function available? My requirement is to replace all non-printable characters. For Example /n - New line
/r - carriage return. But other than these two there are many special characters which are non- printable. Is there any custom function to handle " All Non printable characters" in the below link

My requirement: You will use a loop from left to right for each character and build in output string in the following way

  1. Check whether the character is printable …
  2. If printable add it to output
  3. If not add space to output

Thanks for your help
San


kolluri85 :india: (BOB member since 2008-09-10)

There are only 15 non printable characters. So just use 15 replace_substr() calls.


DanHosler :us: (BOB member since 2013-06-19)