Coding problem: Finding all suttas with number of characters > X

I currently have an array that contains ids for all of the suttas translated by Bhante Sujato. If I wanted to come up with a new list of ids for suttas whose length was greater than X number of characters, what would be the best way to do that?

If fetch was synchronous, then I would just fetch each sutta one by one and test its length. But since it’s not, I’m not sure the best way to go about doing this.

I’m asking because in the random sutta getter app there are suttas, especially in the repetition series in SN and AN where the “sutta” is a very small part of a peyalla, so it ends up being kind of meaningless.

I could test each sutta after fetching it and before displaying it. But since this is a fairly static thing, it seems better to simply change the array of ids that I am using to be just those over a certain length.

2 Likes