#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    42
    Rep Power
    1

    How to omit/Eliminate quotes around String at Delphi ?


    I am displaying string data at Delphi xe3

    Code:
    while not UniTable1.Eof do
    begin
     myid[k] := UniTable1.FieldByName('id').Value;
     mydesc[k] :=  ''''+UniTable1.FieldByName('description').Value+'''';
     showmessage(mydesc[k]);
     UniTable1.Next;
     inc(k);
    end;
    It is displaying description output as 'aaa' , 'bbb' with quotes around description string.

    Is there any way to display description data without quotes ?
    i.e aaa , bbb etc..
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    350
    Rep Power
    7
    Originally Posted by ninadgac
    I am displaying string data at Delphi xe3

    Code:
    while not UniTable1.Eof do
    begin
     myid[k] := UniTable1.FieldByName('id').Value;
     mydesc[k] :=  ''''+UniTable1.FieldByName('description').Value+'''';
     showmessage(mydesc[k]);
     UniTable1.Next;
     inc(k);
    end;
    It is displaying description output as 'aaa' , 'bbb' with quotes around description string.

    Is there any way to display description data without quotes ?
    i.e aaa , bbb etc..
    This line of code actually tacks on the quotes for you
    mydesc[k] := ''''+UniTable1.FieldByName('description').Value+'''';
    so if you don't want the quotes, just don't add them
    mydesc[k] := UniTable1.FieldByName('description').Value;

    but in case you do need the quotes for other reasons, then you can strip off the 1st and last character from what you want to display.
    showmessage(Copy(mydesc[k], 2, Length(mydesc[k])-2));

    Comments on this post

    • ninadgac agrees

IMN logo majestic logo threadwatch logo seochat tools logo