1. John Vanleeuwe
  2. PowerBuilder
  3. Wednesday, 3 January 2024 01:04 AM UTC

 Hi guys,

i am receiving data from external parties.

We have noticed that some of these send us data with hex 0A character (line feed)

My question is how can i detect this when the data is in a PB string variable ?

I do know the character is there, because when i copy the contents it to the clipboard and then paste it in the site www.hexed.it i can see the 0A character.

 

TIA

John

 

 
Accepted Answer
mike S Accepted Answer Pending Moderation
  1. Wednesday, 3 January 2024 03:49 AM UTC
  2. PowerBuilder
  3. # Permalink

you can use: RightTrim( string, TRUE) to remove all whitespace at the end.

https://docs.appeon.com/pb2021/powerscript_reference/trim_func.html

 

the list of which whitespace the TRUE will remove is here:  LeftTrim - - PowerScript Reference (appeon.com)

 

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 3 January 2024 01:30 AM UTC
  2. PowerBuilder
  3. # 1

Hi John;

  Use the POS() command & look for a "~r" (line feed). Then use the Replace() command, replacing that with a "".  HTH

FYI: https://docs.appeon.com/pb2022/powerscript_reference/xREF_36556_Special_ASCII.html

Regards ... Chris 

Comment
  1. Arnd Schmidt
  2. Tuesday, 9 January 2024 21:04 PM UTC
A line feed would be '~n'.

https://en.wikipedia.org/wiki/Newline
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 9 January 2024 22:32 PM UTC
That would be a "New Line" now a CR. However, that could be what John is encountering.
  1. Helpful
  1. Arnd Schmidt
  2. Tuesday, 9 January 2024 23:13 PM UTC
sigh...I wonder if the PowerBuilder doc is wrong claiming "Newline" to be a line feed (LF) aka '~n' and Carriage Return (CR) to be '~r'.







  1. Helpful
There are no comments made yet.
John Vanleeuwe Accepted Answer Pending Moderation
  1. Wednesday, 3 January 2024 01:07 AM UTC
  2. PowerBuilder
  3. # 2

Ideally i need to detect and replace it with ''.

Forgot to include this info in my original post.

 

TIA

 

 
Comment
There are no comments made yet.
John Vanleeuwe Accepted Answer Pending Moderation
  1. Tuesday, 9 January 2024 06:08 AM UTC
  2. PowerBuilder
  3. # 3

hi Chris, that's the weird thing , i've tried this ,but it didnt work :(

 

 
Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 9 January 2024 20:26 PM UTC
Yes, it should. I would need a test file in order to validate.
  1. Helpful
There are no comments made yet.
John Vanleeuwe Accepted Answer Pending Moderation
  1. Tuesday, 9 January 2024 06:09 AM UTC
  2. PowerBuilder
  3. # 4

This one worked for me , not sure why Chris suggestion with the pos didnt work :(

 

 
Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.