Jump to content

Delphi: How do I get '&' character from a source?


Recommended Posts

A process included in my application uses Results in a string, which sometimes needs to include the '&' symbol. I know replacing '_ ' with '&&' would get it, however is there a way to handle the string where it doesn't amperand the character?

This is really hard to explain... basically is there a method to safely detect '&' characters in a string and replace them with '&&', or prevent them from becoming amperanded at all?

An example of an unsuccessfull call would be:

Save a text file containing the contents '& ' as C:\test.txt

In Delphi place a memo and button on the form, Memo1 and Button1 respectively

Button1.click:

begin
Memo1.loadfromfile('C:\test.txt');
showmessage(Memo1.lines[0]);
end

Where it would show '_' in the showmessage.

Edited by BrainDrain
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...