Delphi32.com - Home!
| Home/News | Downloads | Forums | D32 Magazine | Resources | Info and Facts |  
 
 Embedding a quite in a string.


How can I embed a quote in a string since it is a reserved delimiter?   

    You can either use two single quote characters where a single quote is required, or define a constant who's value is character number 39. If you have many quotes to embed (this can happen in a complex SQL statement), the second method is preferred. Example:

    const Quote = #39;
    {This line will not compile!}
    ShowMessage('The smith's yard is greener than ours');
    {This line will compile}
    ShowMessage('The smith''s yard is greener than ours');
    {This line will compile}
    ShowMessage('The smith' + Quote + 's yard is greener than ours');
    

     



  << Previous Faq     Complete List     Next Faq >>  



 
 Hits/month  2,500,000+ 
 Downloads
 (Since May 2000)
 7,393,709 
 Total Files  6,023 
 Forum msgs  7,670 
 Articles/FAQs  70+/900+ 
Kylix
Tips n Tricks
FAQs
Knowledge Base
Bug Listings
Articles
Books
Newsgroups
Links
Submissions
Testimonials
Advertising
Contact Us
About Us
Search Amazon:
Top Selling Software at Amazon

| Home/News | Downloads | Forums | Resources | Info and Facts | Testimonials |
  Site Search:
 


Comments/Problems: Webmaster@delphi32.com
Copyright © 1998-2006, Delphi32.com. All rights reserved.
Terms of Use