IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

July Edition
Subscribe now! It's Free!
Enter your email:

   ► KBProgrammingDelphi for W...Using Data   Print This    All Groups  
  From the January 2016 Issue of Prestwood eMag
 
Delphi Using Data:
Quoting Your String (QuotedStr and AnsiQuotedStr)
 
Posted 12 years ago on 12/12/2008
Take Away: When you need to put quotes, single or double, or even another character, around a string there are two methods to lend a hand: QuotedStr and AnsiQuotedStr. QuotedStr will put single (') quotes around your string or variable. The other function you can call is AnsiQuotedStr which adds double quotes.
 A flashcard from our Delphi Flashcards Library
 A tip from our Delphi Tips Page

KB101532

When you need to put quotes, single or double, or even another character, around a string there are two methods to lend a hand.
QuotedStr(): QuotedStr will put single (') quotes around your string or variable.

Example:

sWork := QuotedStr('Hello');
ShowMessage(sWork); // this will show 'Hello' - with the quotes

 
Example 2:

Work := QuotedStr(sSomeVariable);

This will put quotes around whatever is in sSomeVariable.

The other function you can call is AnsiQuotedStr

ShowMessage(AnsiQuotedStr('Hello', chr(34));

This will show "Hello" because chr(34) is the double quote


Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P195A1
Enter key:
Tip Contributed By Daniel Kram:
Visit Profile

 KB Article #101532 Counter
24238
Since 12/12/2008
Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


©1995-2020 Prestwood IT Solutions.   [Security & Privacy]