× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello,


I would go with Michael’s approach as the most efficient - except
there is no need to define “string” as a field, simply name the DS
itself as “string".


Efficient, yes, but not very versatile. Doing it that way, you must always include all elements in the array, and you are limited in how they are concatenated (it must always be as one big string).

For example, suppose you wanted a comma between each element in the array...

for x = 1 to highestUsedArrayElement;
if x=1;
string = array(x);
else;
string += ',' + array(x);
endif;
endfor;

Same with any other separator. Maybe the array contains words that should be separated by spaces, for example... easy to do with a loop.

in JavaScript, there's something called join that makes this very easy, I like the way that works.

string = array.join(',');

RPG doesn't have that, of course, so you use the loop. I haven't found any instances where it makes sense to use a DS overlay, because it's unusual for me to have an array where I always use all elements of it. Most of the time there's unused elements at the end. Also, this special handing of inserting something between the elements is something I need often, and there's no way to do that with the DS approach.

Jeff said one thing that puzzles me. He said it's always filled with semicolons... That's weird. Why would you use an array for something like that? Just do this:

string = *all';';

now the string is filled with all semicolons. isn't that a lot easier?

-SK

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.