Hello,
I was wondering is there a way to display everything in a list as text without propagating through the list using a loop.
For example: if i had a list named Fruit and it contained fruit. declared as such:
var/list/Fruit = list("Apples", "Oranges", "Pears")
is there a way to pass the list as an argument without an index and it will print the entire list. as in:
"blah blah [Fruit] yada yada" and it would print:
blah blah Apples, Oranges, Pears yada yada.
The reason for this question is that im using a library function that takes text as an argument and if this was possible it would cut some code out.
Thanks in advance to everyone for your input,
Remaru Senata
ID:156274
Nov 21 2010, 5:30 am
|
|
What you could do is encapsulate the loop in an independent proc that lets you do this 'list to text' conversion action without needing to rewrite or copy it each time you want to do it.
The above proc could also be rewritten in a number of other ways. You could prevent the last separator from being added in the first place, rather than removing it.
This kind of proc is in fact common and thus is included in many list and/or text-handling libraries, so you could simply include one in your project and use it, if you so desire. One such well-known library is hub://Deadron.TextHandling, but there are other good ones as well.