[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to remove the newline charecter from the String

Posted on 2000-05-09
7
Medium Priority
?
216 Views
Last Modified: 2010-08-05
A wideString str contains a string with a newline charecter(Enter key ).
I am trying to copy the WideString value to String variable. It is copying #$D#$A charecters in place of the enter key or new line charecter. How to remove this from the String.
0
Comment
Question by:kiru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 5

Accepted Solution

by:
TheNeil earned 300 total points
ID: 2791560
Do the copy as before and then check every character in the String:

TempStr := WideStr;
NormalStr := '';
FOR n := 1 TO Length(TempStr)
DO
  IF NOT(TempStr[n] IN [#10, #13])
  THEN
    NormalStr := NormalStr + TempStr[n];

Not the most elegant of solutions but it works.

The Neil =:)
0
 

Author Comment

by:kiru
ID: 2791583
Edited text of question.
0
 
LVL 10

Expert Comment

by:Lischke
ID: 2791589
Hi kiru,

I'm not sure if removing the newline/linefeed combination is what you really want. You should distinct between the enter key (which is just a key and can be interpreted in different ways) and the NL/LF combination, which CAN be the result of pressing the enter key (but must not).

You wrote that copying the wide string to an ANSI string copies NL/LF instead of enter key. This makes no sense, as there's no line break character yet in the target string which could be replaced by NL/LF. So my assumption is that you have NL/LF in your wide string and want it totally removed (which will break the text layout) or replaced by something else. Can you confirm this?

Ciao, Mike
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 10

Expert Comment

by:Lischke
ID: 2791600
Oh, while I wrote my comment you changed the question's text. But unfortunately it still makes no sense. What exactly does the wide string contain? Is it just a new line (NL = Char(13)) or a NL/LF combination or what else?

Ciao, Mike
0
 

Author Comment

by:kiru
ID: 2791767
Edited text of question.
0
 

Author Comment

by:kiru
ID: 2791788
I found a solution as TheNeil has put it. I searched for #13 & #10 & removed them from the string(not in widestring, normal string). It is working fine.
 Lischike ,in widestring it shows some
charecter similar to capital I.


0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2791819
Thanks Kiru. Your 'capital I' problem might be something that the character set can't display. What you could do is change my example to do this:

  IF TempStr[n] IN ['A'..'Z', 'a'..'z', '0'..'9', ',']
  THEN
    NormalStr := NormalStr + TempStr[n];

You'll need to extend the set to cover all of the characters that you want to actually allow but it will filter out anything that you don't want (or expect)

The Neil =:)
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question