title: Copy Sub Item Of List View Delphi Into Clipboard
body: <p>I have a List View with eight columns and a popup menu. 
  [ScreenShot]<img src="https://i.stack.imgur.com/L5zVo.png" alt="image"></p>
  
  <p>I have this code which is work great to copy into clipboard all items and sub items when a row or all rows selected. </p>
  
  <pre><code>procedure TForm1.CopyURL1Click(Sender: TObject);
  var 
    lv : TbsSkinListView;
    s : string;
    c,f,k : integer;
  
  begin
    lv := bsSkinListView1;
    Clipboard.Clear;
    s := '';
  
    for f := 0 to lv.Items.Count - 1 do
    begin     
       k := 0;
       if lv.Items[f].Selected then
       begin
         s := s + Format('%s : %s, ',[lv.Columns[k].Caption, lv.Items[f].Caption]);
         for c := 0 to lv.Items[f].SubItems.Count - 1 do
         begin
           Inc(k);
           s := s + Format('%s : %s, ',[lv.Columns[k].Caption, lv.Items[f].SubItems[c]]);
         end;
        SetLength(s, Length(s) - 2);
        s := s + #$D#$A;
      end;      
    end;
    clipboard.AsText := s;
  end;
  </code></pre>
  
  <p>What i need is I'd like to copy only the caption of column one (column "Title") with it's sub items [0], and copy the column 8 caption (column "URL") with it's sub items [7] into clipboard, when a row or all rows selected. </p>
  
  <p>Also sometime sub items[7] is empty, and it shouldn't get index out of bounds (7) error message.</p>
  
  <p>From my screenshot above, when i copy the 1st row, the result should return like this </p>
  
  <pre><code>Title : 10 Things You Didn't Know...  URL :   &lt;=== this is an empty sub items [7]
  </code></pre>
  
  <p>when 2nd row copied: </p>
  
  <pre><code>Title : 10 Things You Didn't Know...  URL : http://www.example.com
  </code></pre>
  
  <p>All rows selected :</p>
  
  <pre><code>Title : 10 Things You Didn't Know...  URL : 
  Title : 10 Things You Didn't Know...  URL : http://www.example.com
  </code></pre>
  
  <p>i have try this <a href="https://stackoverflow.com/questions/6786625/how-to-copy-multiple-selected-rows-of-listview-into-clipboard-in-delphi">link</a> but it doesn't meet or not work as i need. I'm using Delphi XE 4. How do i achieve this? Any help would be highly appreciated.</p>