Skip to main content

I have a rich multi-line text box with the string “Testing field. ENTER”.  If I press the enter key (carriage return) before the word “ENTER”, it adds a “/n”,  which I believe stands for new line or end of line, to the text property of the rich text box which then looks like follows: "Testing Field. \\nENTER."

When I move the text string from my rich text box into a string variable, it moves the “\\n” which give me problems when I attempt to do data manipulation with the string variable.  I cannot remove the “\\n” programmatically in the code because it is invisible to the code. I can only see it when a view the text property of my rich text box during runtime.

I should also mention that after pressing the enter key before the word “ENTER”, it configures the ‘Lines’ property of the rich text box as follows:

Lines

  [0]  “Testing Field.”

  [1] “ENTER”

 

I want to be able to move both lines [0] and [1] as a single string into a string variable and without the “\\n”.

I have a rich multi-line text box with the string “Testing field. ENTER”.  If I press the enter key (carriage return) before the word “ENTER”, it adds a “/n”,  which I believe stands for new line or end of line, to the text property of the rich text box which then looks like follows: "Testing Field. \\nENTER."

When I move the text string from my rich text box into a string variable, it moves the “\\n” which give me problems when I attempt to do data manipulation with the string variable.  I cannot remove the “\\n” programmatically in the code because it is invisible to the code. I can only see it when a view the text property of my rich text box during runtime.

I should also mention that after pressing the enter key before the word “ENTER”, it configures the ‘Lines’ property of the rich text box as follows:

Lines

  [0]  “Testing Field.”

  [1] “ENTER”

 

I want to be able to move both lines [0] and [1] as a single string into a string variable and without the “\\n”.

The \\n means newline character but if you view it in hex what it is actually embedding is a X"0A" or the LineFeed character.

Right-click on the variable while debugging and click on Hexadecimal display and you will see:

richTextBox1 = {Text = x"54657374696E67206669656C642E200A454E544552"}

You could replace all occurrences of the X"0A" by spaces with the following:

               move richTextBox1::Text to mystring
               inspect mystring replacing all X"0A" by " "


The \\n means newline character but if you view it in hex what it is actually embedding is a X"0A" or the LineFeed character.

Right-click on the variable while debugging and click on Hexadecimal display and you will see:

richTextBox1 = {Text = x"54657374696E67206669656C642E200A454E544552"}

You could replace all occurrences of the X"0A" by spaces with the following:

               move richTextBox1::Text to mystring
               inspect mystring replacing all X"0A" by " "

This worked, thank you!

This worked, thank you!

Just as a reminder ... searching the forum to see if the question has already been answered sometimes works.  For example:

https://community.microfocus.com/t5/Visual-COBOL-Forum/String-handling-carriage-return-line-feed-new-line-0d0a/m-p/1735063#M7722

 


Just as a reminder ... searching the forum to see if the question has already been answered sometimes works.  For example:

https://community.microfocus.com/t5/Visual-COBOL-Forum/String-handling-carriage-return-line-feed-new-line-0d0a/m-p/1735063#M7722

 

I will keep that in mind, thank you. But I should mention that it is sometimes difficult finding the topic of inquiry in the forum given that the subject name may be worded in a way that is different than the one that is being searched.