Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you insert the ' symbol? 3

Status
Not open for further replies.

PaidtheUmpire

Programmer
Jan 4, 2004
105
0
0
AU
I want to have the following in a string


I can't do it.

How do you place the ' symbol inside a pair of ''s.
Know what I'm getting at?

I think it'll look kind of like this...

'I can' + ???? + 't do it.'

Any help?
 
Here's how to do it:

sString := 'I can''t do it.';

Or if you like you can do it like this:

sString := 'I can' + '''' + 't do it.';

So always when you want to add ' into a string just insert '' in to the string where you want the ' to show.
 
Pikkunero's right. My mistake. Haven't woke up yet.

--- McMerfy
 
With all due respect to McMerfy...

and assuming you want the string

I can't do it

my compiler seems to like

AStr := 'I can''t do it';

fairly well, and it shows up correctly when I run

ShowMessage('I can''t do it');

JGS

Regards and HTH,
JGS
 
If you have an apostrophe in a string that's not a constant, like a field value from a database, you can use the QuotedStr function to automatically setup the string so that it can be used in other functions like ShowMessage.

-Dell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top