Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

displaying a collection  RSS feed

 
Maureen Charlton
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code to display a collection:



The above code gives me the following output to screen:

Entry Set is:
[NV52SSD=NV52SSD 1003 Ford Mondeo White, QP43SSX=qp43SSX 100
3 Ford Fiesta Pink, ZZ43SSX=ZZ43SSX 0182 Ford Fiesta
Yellow]
The number of records within the collections is: 3

Is there a way of tidying up the way a collection is displayed?
i.e. can you edit it in some way using the \t for tabs like you would normally?
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can iterate the collection manually and append each element to a StringBuffer along with some delimiter in between (tab for example).
 
Maureen Charlton
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James,

You darling! I've spent hours trying to find a way to do this.

Thank you.
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I try!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!