Link to home
Start Free TrialLog in
Avatar of kiru
kiru

asked on

How to remove the newline charecter from the String

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.
ASKER CERTIFIED SOLUTION
Avatar of TheNeil
TheNeil

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kiru
kiru

ASKER

Edited text of question.
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
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
Avatar of kiru

ASKER

Edited text of question.
Avatar of kiru

ASKER

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.


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 =:)